added helpers for DoW/DoM/DoH/DoH

- fixed allies not being able to aggro on roam
- fixed static characters aggroing
This commit is contained in:
Tahir Akhlaq 2017-10-11 14:46:24 +01:00
parent 460722d3d5
commit 520ae7a119
18 changed files with 208 additions and 217 deletions

View file

@ -593,8 +593,15 @@ namespace FFXIVClassic_Map_Server
// todo: add to private areas, set up immunity, mob linking,
// - load skill/spell/drop lists, set detection icon, load pool/family/group mods
var allegiance = (CharacterTargetingAllegiance)reader.GetByte("allegiance");
BattleNpc battleNpc = null;
var battleNpc = new BattleNpc(actorId, Server.GetWorldManager().GetActorClass(reader.GetUInt32("actorClassId")),
if (allegiance == CharacterTargetingAllegiance.Player)
battleNpc = new Ally(actorId, Server.GetWorldManager().GetActorClass(reader.GetUInt32("actorClassId")),
reader.GetString("scriptName"), area, reader.GetFloat("positionX"), reader.GetFloat("positionY"), reader.GetFloat("positionZ"), reader.GetFloat("rotation"),
reader.GetUInt16("actorState"), reader.GetUInt32("animationId"), "");
else
battleNpc = new BattleNpc(actorId, Server.GetWorldManager().GetActorClass(reader.GetUInt32("actorClassId")),
reader.GetString("scriptName"), area, reader.GetFloat("positionX"), reader.GetFloat("positionY"), reader.GetFloat("positionZ"), reader.GetFloat("rotation"),
reader.GetUInt16("actorState"), reader.GetUInt32("animationId"), "");

View file

@ -472,7 +472,7 @@ namespace FFXIVClassic_Map_Server.Actors
}
}
public Npc SpawnActor(uint classId, string uniqueId, float x, float y, float z, float rot = 0, ushort state = 0, uint animId = 0, bool isMob = true)
public Npc SpawnActor(uint classId, string uniqueId, float x, float y, float z, float rot = 0, ushort state = 0, uint animId = 0, bool isMob = false)
{
lock (mActorList)
{

View file

@ -168,15 +168,14 @@ 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;

View file

@ -45,6 +45,19 @@ namespace FFXIVClassic_Map_Server.Actors
public const int CLASSID_THM = 22;
public const int CLASSID_CNJ = 23;
public const int CLASSID_CRP = 29;
public const int CLASSID_BSM = 30;
public const int CLASSID_ARM = 31;
public const int CLASSID_GSM = 32;
public const int CLASSID_LTW = 33;
public const int CLASSID_WVR = 34;
public const int CLASSID_ALC = 35;
public const int CLASSID_CUL = 36;
public const int CLASSID_MIN = 39;
public const int CLASSID_BTN = 40;
public const int CLASSID_FSH = 41;
public const int SIZE = 0;
public const int COLORINFO = 1;
public const int FACEINFO = 2;
@ -347,7 +360,7 @@ namespace FFXIVClassic_Map_Server.Actors
public virtual bool IsValidTarget(Character target, ValidTarget validTarget)
{
return true;
return !target.isStatic;
}
public virtual bool CanAttack()
@ -753,6 +766,26 @@ namespace FFXIVClassic_Map_Server.Actors
{
return this is Ally;
}
public bool IsDiscipleOfWar()
{
return currentJob < CLASSID_THM;
}
public bool IsDiscipleOfMagic()
{
return currentJob >= CLASSID_THM && currentJob < CLASSID_CRP;
}
public bool IsDiscipleOfHand()
{
return currentJob >= CLASSID_CRP && currentJob < CLASSID_MIN;
}
public bool IsDiscipleOfLand()
{
return currentJob >= CLASSID_MIN;
}
#endregion lua helpers
#endregion ai stuff
}

View file

@ -34,5 +34,20 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
}
base.DoCombatTick(tick, contentGroupCharas);
}
protected override void DoRoamTick(DateTime tick, List<Character> contentGroupCharas = null)
{
if (owner.currentContentGroup != null)
{
contentGroupCharas = new List<Character>(owner.currentContentGroup.GetMemberCount());
foreach (var charaId in owner.currentContentGroup.GetMembers())
{
var chara = owner.zone.FindActorInArea<Character>(charaId);
if (chara != null)
contentGroupCharas.Add(chara);
}
}
base.DoRoamTick(tick, contentGroupCharas);
}
}
}

View file

@ -127,7 +127,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
// todo:
}
protected virtual void DoRoamTick(DateTime tick)
protected virtual void DoRoamTick(DateTime tick, List<Character> contentGroupCharas = null)
{
if (owner.hateContainer.GetHateList().Count > 0)
{
@ -159,6 +159,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
owner.aiContainer.pathFind.SetPathFlags(PathFindFlags.None);
owner.aiContainer.pathFind.PathInRange(owner.spawnX, owner.spawnY, owner.spawnZ, 1.5f, 50.0f);
}
lua.LuaEngine.CallLuaBattleFunction(owner, "onRoam", owner, contentGroupCharas);
}

View file

@ -18,6 +18,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.npc
{
aiContainer = new AIContainer(this, new AllyController(this), new PathFind(this), new TargetFind(this));
this.allegiance = CharacterTargetingAllegiance.Player;
this.isAutoAttackEnabled = true;
this.isMovingToSpawn = false;
}
}
}

View file

@ -365,7 +365,6 @@ namespace FFXIVClassic_Map_Server.Actors
{
this.isMovingToSpawn = false;
}
lua.LuaEngine.CallLuaBattleFunction(this, "onRoam", this);
}
}

View file

@ -31,19 +31,6 @@ namespace FFXIVClassic_Map_Server.Actors
{
class Player : Character
{
public const int CLASSID_CRP = 29;
public const int CLASSID_BSM = 30;
public const int CLASSID_ARM = 31;
public const int CLASSID_GSM = 32;
public const int CLASSID_LTW = 33;
public const int CLASSID_WVR = 34;
public const int CLASSID_ALC = 35;
public const int CLASSID_CUL = 36;
public const int CLASSID_MIN = 39;
public const int CLASSID_BTN = 40;
public const int CLASSID_FSH = 41;
public const int MAXSIZE_INVENTORY_NORMAL = 200;
public const int MAXSIZE_INVENTORY_CURRANCY = 320;
public const int MAXSIZE_INVENTORY_KEYITEMS = 500;