Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions doc/bt/ZC_NORMAL.bt
Original file line number Diff line number Diff line change
Expand Up @@ -1716,6 +1716,25 @@ switch (type)
int i[count];
break;

// ? (Sent while counter attacking with Matar skill)
// Force Cast Skill?
case 0x1A3:
int CasterHandle;
int skillId;
float f1;
short s1;
short s2;
short s3;
short s4;
short s5;
short s6;
short s7;
byte b1;
short s8;
int i4;
float f2;
break;

// Related to teleport skill?
// Also sent on ? (Sent on assister dungeon)
case 0x1A6:
Expand Down
13 changes: 12 additions & 1 deletion src/Shared/Data/Database/SkillTree.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Melia.Shared.Game.Const;
using Newtonsoft.Json.Linq;
Expand All @@ -21,7 +22,7 @@ public class SkillTreeData
public class SkillTreeDb : DatabaseJson<SkillTreeData>
{
/// <summary>
/// Returns all skills the given job can learn at a certain job
/// Returns all skills the given job can learn at a certain job level
/// level.
/// </summary>
/// <param name="jobId"></param>
Expand All @@ -32,6 +33,16 @@ public SkillTreeData[] FindSkills(JobId jobId, int jobLevel)
return this.Entries.Where(a => a.JobId == jobId && a.UnlockLevel <= jobLevel).ToArray();
}

/// <summary>
/// Returns a list of SkillIds that the given job can learn
/// </summary>
/// <param name="jobId"></param>
/// <returns></returns>
public List<SkillId> FindSkills(JobId jobId)
{
return this.Entries.Where(a => a.JobId == jobId).Select(a => a.SkillId).ToList();
}

/// <summary>
/// Reads given entry and adds it to the database.
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions src/Shared/Network/NormalOp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static class Zone
public const int PlayEffect = 0x16;
public const int PlayForceEffect = 0x17;
public const int UpdateSkillEffect = 0x1F;
public const int UpdateModelColor = 0x20;
public const int FadeOut = 0x38;
public const int BarrackSlotCount = 0x3C;
public const int AttackCancel = 0x41;
Expand All @@ -53,6 +54,8 @@ public static class Zone
public const int Cutscene = 0x6B;
public const int SetSkillSpeed = 0x77;
public const int SetHitDelay = 0x78;
public const int Unknow_7D = 0x7D;
public const int FloorEffect = 0x81;
public const int SpinObject = 0x8A;
public const int Unknown_A1 = 0xA1;
public const int LeapJump = 0xC2;
Expand All @@ -73,6 +76,7 @@ public static class Zone
public const int UpdateSkillUI = 0x189;
public const int AdventureBook = 0x197;
public const int Unknown_19B = 0x19E;
public const int ForceClientCastSkill = 0x1A3;
public const int PadSetModel = 0x1AB;
public const int WigVisibilityUpdate = 0x1AC;
public const int Unknown_1B4 = 0x1B7;
Expand Down
4 changes: 3 additions & 1 deletion src/ZoneServer/Buffs/Base/BuffHandler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Melia.Zone.Scripting;
using Melia.Shared.Game.Const;
using Melia.Zone.Scripting;
using Melia.Zone.World;
using Melia.Zone.World.Actors;
using Melia.Zone.World.Actors.Monsters;

namespace Melia.Zone.Buffs.Base
{
Expand Down
44 changes: 44 additions & 0 deletions src/ZoneServer/Buffs/Handlers/Swordsmen/Matador/Capote_Debuff.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Melia.Shared.Game.Const;
using Melia.Zone.Buffs.Base;
using Melia.Zone.Network;
using Melia.Zone.Scripting.AI;
using Melia.Zone.World.Actors.CombatEntities.Components;

namespace Melia.Zone.Buffs.Handlers.Swordsmen.Peltasta
{
/// <summary>
/// Handle for the Capote Debuff, which increases the thread from the mob to the caster
/// </summary>
[BuffHandler(BuffId.Capote_Debuff)]
public class Capote_Debuff : BuffHandler
{
private const float DecreaseCrtResRate = -0.15f;

public override void OnStart(Buff buff)
{
var target = buff.Target;
var caster = buff.Caster;

Send.ZC_NORMAL.UpdateModelColor(target, 150, 160, 255, 255, 1.5f);

AddPropertyModifier(buff, target, PropertyName.CRTDR_BM, DecreaseCrtResRate);

if (target.Components.TryGet<AiComponent>(out var component))
component.Script.QueueEventAlert(new TauntEventAlert(target, caster));

}

public override void OnEnd(Buff buff)
{
var target = buff.Target;
var caster = buff.Caster;

Send.ZC_NORMAL.UpdateModelColor(target, 255, 255, 255, 255, 1);

RemovePropertyModifier(buff, target, PropertyName.CRTDR_BM);

if (target.Components.TryGet<AiComponent>(out var component))
component.Script.QueueEventAlert(new DecreaseHateEventAlert(target, caster));
}
}
}
34 changes: 34 additions & 0 deletions src/ZoneServer/Buffs/Handlers/Swordsmen/Matador/Ole_Debuff.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Melia.Shared.Game.Const;
using Melia.Zone.Buffs.Base;
using Melia.Zone.Scripting.AI;
using Melia.Zone.World.Actors.CombatEntities.Components;

namespace Melia.Zone.Buffs.Handlers.Swordsmen.Peltasta
{
/// <summary>
/// Handle for the Ole Debuff, which increases the thread from the mob to the caster
/// </summary>
[BuffHandler(BuffId.Ole_Debuff)]
public class Ole_Debuff : BuffHandler
{
private const float DecreaseCrtResRate = -0.15f;

public override void OnStart(Buff buff)
{
var target = buff.Target;
var caster = buff.Caster;

if (target.Components.TryGet<AiComponent>(out var component))
component.Script.QueueEventAlert(new TauntEventAlert(target, caster));
}

public override void OnEnd(Buff buff)
{
var target = buff.Target;
var caster = buff.Caster;

if (target.Components.TryGet<AiComponent>(out var component))
component.Script.QueueEventAlert(new DecreaseHateEventAlert(target, caster));
}
}
}
89 changes: 88 additions & 1 deletion src/ZoneServer/Network/Send.Normal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,6 @@ public static void UnlockCollection(Character character, int collectionId)
character.Connection.Send(packet);
}


/// <summary>
/// Updates the collection for the player.
/// </summary>
Expand All @@ -1320,6 +1319,94 @@ public static void UpdateCollection(Character character, int collectionId, int i

character.Connection.Send(packet);
}

/// <summary>
/// Updates the entity model color
/// </summary>
/// <param name="entity"></param>
/// <param name="targetHandle"></param>
/// <param name="red"></param>
/// <param name="green"></param>
/// <param name="blue"></param>
/// <param name="alpha"></param>
/// <param name="f1"></param>
public static void UpdateModelColor(ICombatEntity entity, int red, int green, int blue, int alpha, float f1)
{
var packet = new Packet(Op.ZC_NORMAL);
packet.PutInt(NormalOp.Zone.UpdateModelColor);

packet.PutInt(entity.Handle);
packet.PutByte((byte)red);
packet.PutByte((byte)green);
packet.PutByte((byte)blue);
packet.PutByte((byte)alpha);
packet.PutByte(1);
packet.PutFloat(f1);
packet.PutByte(1);

entity.Map.Broadcast(packet);
}

/// <summary>
/// Seems to force the client to cast a skill (used on Matador's Muleta skill)
/// </summary>
/// <param name="character"></param>
/// <param name="skillId"></param>
/// <param name="castSkillId"></param>
public static void ForceClientCastSkill(Character character, SkillId beforeSkillId, SkillId castSkillId)
{
var packet = new Packet(Op.ZC_NORMAL);
packet.PutInt(NormalOp.Zone.ForceClientCastSkill);

packet.PutInt(character.Handle);
packet.PutInt((int)beforeSkillId);
packet.PutFloat(0.515625f);
packet.PutShort(-32255);
packet.PutShort(164);
packet.PutShort(0);
packet.PutShort(2368);
packet.PutShort(68);
packet.PutShort(22096);
packet.PutShort(62);
packet.PutByte(0xA0);
packet.PutShort(-15173);
packet.PutInt((int)castSkillId);
packet.PutFloat(1000f);

character.Connection.Send(packet);
}

/// <summary>
/// Unkow purposes, used by Matador skill Back Slide
/// </summary>
/// <param name="character"></param>
/// <param name="skillId"></param>
public static void Unknow_7D(Character character, SkillId skillId)
{
var packet = new Packet(Op.ZC_NORMAL);
packet.PutInt(NormalOp.Zone.Unknow_7D);

packet.PutInt(character.Handle);
packet.PutInt((int)skillId);

character.Map.Broadcast(packet);
}

/// <summary>
/// Unkow purposes, used by Matador skill Back Slide
/// </summary>
/// <param name="character"></param>
/// <param name="skillId"></param>
public static void FloorEffect(Character character, SkillId skillId)
{
var packet = new Packet(Op.ZC_NORMAL);
packet.PutInt(NormalOp.Zone.FloorEffect);

packet.PutInt(character.Handle);
packet.PutInt((int)skillId);

character.Map.Broadcast(packet);
}
}
}
}
19 changes: 19 additions & 0 deletions src/ZoneServer/Network/Send.cs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,25 @@ public static void ZC_COOLDOWN_CHANGED(Character character, Cooldown cooldown)
character.Connection.Send(packet);
}

/// <summary>
/// Reduces a cooldown on the character's client.
/// </summary>
/// <param name="character"></param>
/// <param name="cooldown"></param>
/// <param name="reductionInMilliseconds"></param>
public static void ZC_COOLDOWN_CHANGED(Character character, Cooldown cooldown, double reductionInMilliseconds)
{
var packet = new Packet(Op.ZC_COOLDOWN_CHANGED);

packet.PutLong(character.ObjectId);
packet.PutInt((int)cooldown.Id);
packet.PutInt((int)cooldown.Remaining.TotalMilliseconds);
packet.PutInt(0);
packet.PutByte(0);

character.Connection.Send(packet);
}

/// <summary>
/// Sends ZC_SKILLMAP_LIST to character.
/// </summary>
Expand Down
Loading