mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
fixed mob loading from db
- todo: see todos in code (all 169 of them)
This commit is contained in:
parent
7c30b95c4b
commit
645a1fb4fb
@ -427,46 +427,61 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
var query = @"
|
var query = @"
|
||||||
SELECT bsl.uniqueId, bsl.groupId, bsl.positionX, bsl.positionY, bsl.positionZ, bsl.rotation,
|
SELECT bsl.groupId, bsl.positionX, bsl.positionY, bsl.positionZ, bsl.rotation,
|
||||||
bgr.groupId, bgr.genusId, bgr.actorClassId, bgr.minLevel, bgr.maxLevel, bgr.respawnTime,
|
bgr.groupId, bgr.poolId, bgr.actorClassId, bgr.scriptName, bgr.minLevel, bgr.maxLevel, bgr.respawnTime, bgr.hp, bgr.mp,
|
||||||
bgr.hp, bgr.mp, bgr.skillListId, bgr.spellListId, bgr.dropListId, bgr.allegiance,
|
bgr.dropListId, bgr.allegiance, bgr.spawnType, bgr.animationId, bgr.actorState, bgr.privateAreaName, bgr.privateAreaLevel, bgr.zoneId,
|
||||||
bgr.spawnType, bgr.animationId, bgr.actorState, bgr.privateAreaName, bgr.privateAreaLevel, bgr.zoneId,
|
bpo.poolId, bpo.genusId, bpo.currentJob, bpo.combatSkill, bpo.combatDelay, bpo.combatDmgMult, bpo.aggroType,
|
||||||
|
bpo.immunity, bpo.linkType, bpo.skillListId, bpo.spellListId,
|
||||||
bge.genusId, bge.modelSize, bge.kindredId, bge.detection, bge.hpp, bge.mpp, bge.tpp, bge.str, bge.vit, bge.dex,
|
bge.genusId, bge.modelSize, bge.kindredId, bge.detection, bge.hpp, bge.mpp, bge.tpp, bge.str, bge.vit, bge.dex,
|
||||||
bge.int, bge.mnd, bge.pie, bge.att, bge.acc, bge.def, bge.eva, bge.slash, bge.pierce, bge.h2h, bge.blunt,
|
bge.int, bge.mnd, bge.pie, bge.att, bge.acc, bge.def, bge.eva, bge.slash, bge.pierce, bge.h2h, bge.blunt,
|
||||||
bge.fire, bge.ice, bge.wind, bge.lightning, bge.earth, bge.water FROM
|
bge.fire, bge.ice, bge.wind, bge.lightning, bge.earth, bge.water
|
||||||
server_battlenpc_spawn_locations bsl INNER JOIN server_battlenpc_groups bgr ON bsl.groupId = bgr.groupId INNER JOIN
|
FROM server_battlenpc_spawn_locations bsl
|
||||||
server_battlenpc_genus bge ON bgr.genusId = bgr.genusId WHERE bgr.zoneId = {0} GROUP BY bsl.bnpcIndex;
|
INNER JOIN server_battlenpc_groups bgr ON bsl.groupId = bgr.groupId
|
||||||
|
INNER JOIN server_battlenpc_pools bpo ON bgr.poolId = bpo.poolId
|
||||||
|
INNER JOIN server_battlenpc_genus bge ON bpo.genusId = bge.genusId
|
||||||
|
WHERE bgr.zoneId = @zoneId GROUP BY bsl.bnpcIndex;
|
||||||
";
|
";
|
||||||
Debugger.Break();
|
|
||||||
foreach (var zone in zoneList.Values)
|
var count = 0;
|
||||||
|
foreach (var zonePair in zoneList)
|
||||||
{
|
{
|
||||||
query = String.Format(query, zone.GetZoneID());
|
var zone = zonePair.Value;
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||||
|
cmd.Parameters.AddWithValue("@zoneId", zonePair.Key);
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
int actorId = zone.GetActorCount() + 1;
|
int actorId = zone.GetActorCount() + 1;
|
||||||
|
|
||||||
|
// todo: add to private areas, set up immunity, mob linking,
|
||||||
|
// - load skill/spell/drop lists, set npcWork.hateType,
|
||||||
|
|
||||||
var battleNpc = new BattleNpc(actorId, Server.GetWorldManager().GetActorClass(reader.GetUInt32("actorClassId")),
|
var battleNpc = new BattleNpc(actorId, Server.GetWorldManager().GetActorClass(reader.GetUInt32("actorClassId")),
|
||||||
reader.GetString("uniqueId"), zone, reader.GetFloat("positionX"), reader.GetFloat("positionY"), reader.GetFloat("positionZ"), reader.GetFloat("rotation"),
|
reader.GetString("scriptName"), zone, reader.GetFloat("positionX"), reader.GetFloat("positionY"), reader.GetFloat("positionZ"), reader.GetFloat("rotation"),
|
||||||
reader.GetUInt16("actorState"), reader.GetUInt32("animationId"), "");
|
reader.GetUInt16("actorState"), reader.GetUInt32("animationId"), "");
|
||||||
|
|
||||||
|
battleNpc.neutral = reader.GetByte("aggroType") == 0;
|
||||||
|
|
||||||
|
battleNpc.SetDetectionType(reader.GetUInt32("detection"));
|
||||||
battleNpc.kindredType = (KindredType)reader.GetUInt32("kindredId");
|
battleNpc.kindredType = (KindredType)reader.GetUInt32("kindredId");
|
||||||
battleNpc.npcSpawnType = (NpcSpawnType)reader.GetUInt32("spawnType");
|
battleNpc.npcSpawnType = (NpcSpawnType)reader.GetUInt32("spawnType");
|
||||||
|
|
||||||
|
// todo: set hateType to appropriate detectionType thing
|
||||||
|
//battleNpc.npcWork.hateType
|
||||||
|
battleNpc.charaWork.parameterSave.state_mainSkill[0] = reader.GetByte("currentJob");
|
||||||
battleNpc.charaWork.parameterSave.state_mainSkillLevel = (short)Program.Random.Next(reader.GetByte("minLevel"), reader.GetByte("maxLevel"));
|
battleNpc.charaWork.parameterSave.state_mainSkillLevel = (short)Program.Random.Next(reader.GetByte("minLevel"), reader.GetByte("maxLevel"));
|
||||||
|
|
||||||
|
battleNpc.allegiance = (CharacterTargetingAllegiance)reader.GetByte("allegiance");
|
||||||
|
|
||||||
// todo: setup private areas and other crap and
|
// todo: setup private areas and other crap and
|
||||||
// set up rest of stat resists
|
// set up rest of stat resists
|
||||||
battleNpc.SetMod((uint)Modifier.Hp, reader.GetUInt32("hp"));
|
battleNpc.SetMod((uint)Modifier.Hp, reader.GetUInt32("hp"));
|
||||||
battleNpc.SetMod((uint)Modifier.HpPercent, reader.GetUInt32("hpp"));
|
battleNpc.SetMod((uint)Modifier.HpPercent, reader.GetUInt32("hpp"));
|
||||||
battleNpc.SetMod((uint)Modifier.Mp, reader.GetUInt32("mp"));
|
battleNpc.SetMod((uint)Modifier.Mp, reader.GetUInt32("mp"));
|
||||||
battleNpc.SetMod((uint)Modifier.MpPercent, reader.GetUInt32("mpp"));
|
battleNpc.SetMod((uint)Modifier.MpPercent, reader.GetUInt32("mpp"));
|
||||||
battleNpc.SetMod((uint)Modifier.Tp, reader.GetUInt32("tp"));
|
|
||||||
battleNpc.SetMod((uint)Modifier.TpPercent, reader.GetUInt32("tpp"));
|
battleNpc.SetMod((uint)Modifier.TpPercent, reader.GetUInt32("tpp"));
|
||||||
|
|
||||||
battleNpc.SetMod((uint)Modifier.Strength, reader.GetUInt32("str"));
|
battleNpc.SetMod((uint)Modifier.Strength, reader.GetUInt32("str"));
|
||||||
@ -480,19 +495,19 @@ namespace FFXIVClassic_Map_Server
|
|||||||
battleNpc.SetMod((uint)Modifier.Defense, reader.GetUInt32("def"));
|
battleNpc.SetMod((uint)Modifier.Defense, reader.GetUInt32("def"));
|
||||||
battleNpc.SetMod((uint)Modifier.Evasion, reader.GetUInt32("eva"));
|
battleNpc.SetMod((uint)Modifier.Evasion, reader.GetUInt32("eva"));
|
||||||
|
|
||||||
//battleNpc.SetMod((uint)Modifier.ResistFire, )
|
|
||||||
|
|
||||||
battleNpc.SetAggroType(reader.GetUInt32("detection"));
|
|
||||||
|
|
||||||
// todo: load spell/skill/drop lists
|
|
||||||
battleNpc.dropListId = reader.GetUInt32("dropListId");
|
battleNpc.dropListId = reader.GetUInt32("dropListId");
|
||||||
battleNpc.spellListId = reader.GetUInt32("spellListId");
|
battleNpc.spellListId = reader.GetUInt32("spellListId");
|
||||||
battleNpc.skillListId = reader.GetUInt32("skillListId");
|
battleNpc.skillListId = reader.GetUInt32("skillListId");
|
||||||
|
|
||||||
|
//battleNpc.SetMod((uint)Modifier.ResistFire, )
|
||||||
|
|
||||||
zone.AddActorToZone(battleNpc);
|
zone.AddActorToZone(battleNpc);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Program.Log.Info("Loaded {0} monsters.", count);
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,6 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
this.moveSpeeds[2] = SetActorSpeedPacket.DEFAULT_RUN;
|
this.moveSpeeds[2] = SetActorSpeedPacket.DEFAULT_RUN;
|
||||||
this.moveSpeeds[3] = SetActorSpeedPacket.DEFAULT_ACTIVE;
|
this.moveSpeeds[3] = SetActorSpeedPacket.DEFAULT_ACTIVE;
|
||||||
|
|
||||||
// todo: make this halal
|
|
||||||
this.moveState = this.oldMoveState;
|
this.moveState = this.oldMoveState;
|
||||||
this.updateFlags |= ActorUpdateFlags.Speed;
|
this.updateFlags |= ActorUpdateFlags.Speed;
|
||||||
}
|
}
|
||||||
@ -649,13 +648,13 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
rotation = (float)dRot;
|
rotation = (float)dRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo: is this legit?
|
||||||
public bool IsFacing(float x, float z, float angle = 40.0f)
|
public bool IsFacing(float x, float z, float angle = 40.0f)
|
||||||
{
|
{
|
||||||
angle = (float)(Math.PI * angle / 180);
|
angle = (float)(Math.PI * angle / 180);
|
||||||
return Math.Abs(Vector3.GetAngle(positionX, positionZ, x, z) - rotation) < angle;
|
return Math.Abs(Vector3.GetAngle(positionX, positionZ, x, z) - rotation) < angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: is this legit?
|
|
||||||
public bool IsFacing(Actor target, float angle = 40.0f)
|
public bool IsFacing(Actor target, float angle = 40.0f)
|
||||||
{
|
{
|
||||||
if (target == null)
|
if (target == null)
|
||||||
|
@ -182,18 +182,15 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
// todo:
|
|
||||||
path?.Clear();
|
path?.Clear();
|
||||||
pathFlags = PathFindFlags.None;
|
pathFlags = PathFindFlags.None;
|
||||||
distanceFromPoint = 0.0f;
|
distanceFromPoint = 0.0f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private float GetSpeed()
|
private float GetSpeed()
|
||||||
{
|
{
|
||||||
float baseSpeed = owner.GetSpeed();
|
float baseSpeed = owner.GetSpeed();
|
||||||
|
|
||||||
// todo: get actual speed crap
|
|
||||||
if (!(owner is Player))
|
if (!(owner is Player))
|
||||||
{
|
{
|
||||||
if (owner is BattleNpc)
|
if (owner is BattleNpc)
|
||||||
|
@ -381,7 +381,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
this.durationMs = durationMs;
|
this.durationMs = durationMs;
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
|
|
||||||
// todo: use tick instead of now?
|
|
||||||
this.startTime = DateTime.Now;
|
this.startTime = DateTime.Now;
|
||||||
this.lastTick = startTime;
|
this.lastTick = startTime;
|
||||||
}
|
}
|
||||||
@ -415,19 +414,14 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
// return true when duration has elapsed
|
// return true when duration has elapsed
|
||||||
public bool Update(DateTime tick)
|
public bool Update(DateTime tick)
|
||||||
{
|
{
|
||||||
// todo: maybe not tick if already reached duration?
|
|
||||||
if (tickMs != 0 && (tick - lastTick).TotalMilliseconds >= tickMs)
|
if (tickMs != 0 && (tick - lastTick).TotalMilliseconds >= tickMs)
|
||||||
{
|
{
|
||||||
// todo: call effect's onTick
|
|
||||||
// todo: maybe keep a global lua object instead of creating a new one each time we wanna call a script
|
|
||||||
lastTick = tick;
|
lastTick = tick;
|
||||||
LuaEngine.CallLuaStatusEffectFunction(this.owner, this, "onTick", this.owner, this);
|
LuaEngine.CallLuaStatusEffectFunction(this.owner, this, "onTick", this.owner, this);
|
||||||
}
|
}
|
||||||
// todo: handle infinite duration effects?
|
|
||||||
if (durationMs != 0 && (tick - startTime).TotalMilliseconds >= durationMs)
|
if (durationMs != 0 && (tick - startTime).TotalMilliseconds >= durationMs)
|
||||||
{
|
{
|
||||||
// todo: call effect's onLose
|
|
||||||
// todo: broadcast effect lost packet
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -73,7 +73,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
32001 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),resist,resists)] the effect of [@SHEET(xtx/status,$E8(11),3)].
|
32001 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),resist,resists)] the effect of [@SHEET(xtx/status,$E8(11),3)].
|
||||||
32002 [@SHEET(xtx/status,$E8(11),3)] fails to take effect.
|
32002 [@SHEET(xtx/status,$E8(11),3)] fails to take effect.
|
||||||
*/
|
*/
|
||||||
// todo: check flags/overwritable and add effect to list
|
|
||||||
var effect = GetStatusEffectById(newEffect.GetStatusEffectId());
|
var effect = GetStatusEffectById(newEffect.GetStatusEffectId());
|
||||||
bool canOverwrite = false;
|
bool canOverwrite = false;
|
||||||
if (effect != null)
|
if (effect != null)
|
||||||
@ -100,7 +99,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
{
|
{
|
||||||
effects.Add(newEffect.GetStatusEffectId(), newEffect);
|
effects.Add(newEffect.GetStatusEffectId(), newEffect);
|
||||||
newEffect.SetSilent(silent);
|
newEffect.SetSilent(silent);
|
||||||
// todo: this is retarded..
|
|
||||||
{
|
{
|
||||||
var index = Array.IndexOf(effects.Values.ToArray(), newEffect);
|
var index = Array.IndexOf(effects.Values.ToArray(), newEffect);
|
||||||
owner.charaWork.status[index] = newEffect.GetStatusId();
|
owner.charaWork.status[index] = newEffect.GetStatusId();
|
||||||
@ -128,7 +126,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: this is retarded..
|
|
||||||
{
|
{
|
||||||
var index = Array.IndexOf(effects.Values.ToArray(), effect);
|
var index = Array.IndexOf(effects.Values.ToArray(), effect);
|
||||||
owner.charaWork.status[index] = 0;
|
owner.charaWork.status[index] = 0;
|
||||||
|
@ -150,7 +150,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
{
|
{
|
||||||
validTarget = flags;
|
validTarget = flags;
|
||||||
// todo: maybe this should only be set if successfully added?
|
// todo: maybe this should only be set if successfully added?
|
||||||
this.targetPosition = target.GetPosAsVector3();
|
|
||||||
AddTarget(target, false);
|
AddTarget(target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +160,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
public void FindWithinArea(Character target, ValidTarget flags, TargetFindAOETarget aoeTarget)
|
public void FindWithinArea(Character target, ValidTarget flags, TargetFindAOETarget aoeTarget)
|
||||||
{
|
{
|
||||||
validTarget = flags;
|
validTarget = flags;
|
||||||
// todo: maybe we should keep a snapshot which is only updated on each tick for consistency
|
|
||||||
// are we creating aoe circles around target or self
|
// are we creating aoe circles around target or self
|
||||||
if (aoeTarget == TargetFindAOETarget.Self)
|
if (aoeTarget == TargetFindAOETarget.Self)
|
||||||
this.targetPosition = owner.GetPosAsVector3();
|
this.targetPosition = owner.GetPosAsVector3();
|
||||||
@ -182,7 +180,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
{
|
{
|
||||||
findType = TargetFindCharacterType.PlayerToPlayer;
|
findType = TargetFindCharacterType.PlayerToPlayer;
|
||||||
|
|
||||||
// todo: handle player parties
|
|
||||||
if (masterTarget.currentParty != null)
|
if (masterTarget.currentParty != null)
|
||||||
{
|
{
|
||||||
if ((validTarget & (ValidTarget.Ally | ValidTarget.PartyMember)) != 0)
|
if ((validTarget & (ValidTarget.Ally | ValidTarget.PartyMember)) != 0)
|
||||||
@ -273,7 +270,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
|
|
||||||
private void AddAllInParty(Character target, bool withPet)
|
private void AddAllInParty(Character target, bool withPet)
|
||||||
{
|
{
|
||||||
// todo:
|
|
||||||
var party = target.currentParty as Party;
|
var party = target.currentParty as Party;
|
||||||
if (party != null)
|
if (party != null)
|
||||||
{
|
{
|
||||||
@ -294,10 +290,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||||||
{
|
{
|
||||||
var actors = owner.zone.GetActorsAroundActor<BattleNpc>(owner, 50);
|
var actors = owner.zone.GetActorsAroundActor<BattleNpc>(owner, 50);
|
||||||
|
|
||||||
// todo: should we look for Characters instead in case player is charmed by BattleNpc
|
|
||||||
foreach (BattleNpc actor in actors)
|
foreach (BattleNpc actor in actors)
|
||||||
{
|
{
|
||||||
// todo:
|
|
||||||
AddTarget(actor, false);
|
AddTarget(actor, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||||||
|
|
||||||
public override bool Engage(Character target)
|
public override bool Engage(Character target)
|
||||||
{
|
{
|
||||||
// todo: check distance, last swing time, status effects
|
|
||||||
var canEngage = this.owner.aiContainer.InternalEngage(target);
|
var canEngage = this.owner.aiContainer.InternalEngage(target);
|
||||||
if (canEngage)
|
if (canEngage)
|
||||||
{
|
{
|
||||||
@ -140,7 +139,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||||||
|
|
||||||
if (tick >= waitTime)
|
if (tick >= waitTime)
|
||||||
{
|
{
|
||||||
// todo: aggro cooldown
|
|
||||||
neutralTime = tick.AddSeconds(5);
|
neutralTime = tick.AddSeconds(5);
|
||||||
if (owner.aiContainer.pathFind.IsFollowingPath())
|
if (owner.aiContainer.pathFind.IsFollowingPath())
|
||||||
{
|
{
|
||||||
@ -154,7 +152,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// todo:
|
|
||||||
waitTime = tick.AddSeconds(10);
|
waitTime = tick.AddSeconds(10);
|
||||||
owner.OnRoam(tick);
|
owner.OnRoam(tick);
|
||||||
|
|
||||||
@ -171,11 +168,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||||||
{
|
{
|
||||||
foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50))
|
foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50))
|
||||||
{
|
{
|
||||||
if (!owner.isMovingToSpawn && owner.aiContainer.pathFind.AtPoint() && owner.aggroType != AggroType.None)
|
if (!owner.isMovingToSpawn && owner.aiContainer.pathFind.AtPoint() && owner.detectionType != DetectionType.None)
|
||||||
{
|
{
|
||||||
uint levelDifference = (uint)Math.Abs(owner.charaWork.parameterSave.state_mainSkillLevel - player.charaWork.parameterSave.state_mainSkillLevel);
|
uint levelDifference = (uint)Math.Abs(owner.charaWork.parameterSave.state_mainSkillLevel - player.charaWork.parameterSave.state_mainSkillLevel);
|
||||||
|
|
||||||
if (levelDifference <= 10 || (owner.aggroType & AggroType.IgnoreLevelDifference) != 0 && CanAggroTarget(player))
|
if (levelDifference <= 10 || (owner.detectionType & DetectionType.IgnoreLevelDifference) != 0 && CanAggroTarget(player))
|
||||||
{
|
{
|
||||||
owner.hateContainer.AddBaseHate(player);
|
owner.hateContainer.AddBaseHate(player);
|
||||||
break;
|
break;
|
||||||
@ -287,7 +284,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||||||
|
|
||||||
public bool CanAggroTarget(Character target)
|
public bool CanAggroTarget(Character target)
|
||||||
{
|
{
|
||||||
if (owner.neutral || owner.aggroType == AggroType.None || owner.IsDead())
|
if (owner.neutral || owner.detectionType == DetectionType.None || owner.IsDead())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -326,7 +323,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||||||
|
|
||||||
var distance = Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, target.positionX, target.positionY, target.positionZ);
|
var distance = Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, target.positionX, target.positionY, target.positionZ);
|
||||||
|
|
||||||
bool detectSight = forceSight || (owner.aggroType & AggroType.Sight) != 0;
|
bool detectSight = forceSight || (owner.detectionType & DetectionType.Sight) != 0;
|
||||||
bool hasSneak = false;
|
bool hasSneak = false;
|
||||||
bool hasInvisible = false;
|
bool hasInvisible = false;
|
||||||
bool isFacing = owner.IsFacing(target);
|
bool isFacing = owner.IsFacing(target);
|
||||||
@ -344,7 +341,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((owner.aggroType & AggroType.LowHp) != 0 && target.GetHPP() < 75)
|
if ((owner.detectionType & DetectionType.LowHp) != 0 && target.GetHPP() < 75)
|
||||||
return CanSeePoint(target.positionX, target.positionY, target.positionZ);
|
return CanSeePoint(target.positionX, target.positionY, target.positionZ);
|
||||||
|
|
||||||
if (detectSight && !hasInvisible && isFacing)
|
if (detectSight && !hasInvisible && isFacing)
|
||||||
|
@ -45,7 +45,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// todo: check within attack range
|
|
||||||
owner.LookAt(target);
|
owner.LookAt(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,14 +21,15 @@ using FFXIVClassic_Map_Server.packets.send;
|
|||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum AggroType
|
enum DetectionType
|
||||||
{
|
{
|
||||||
None = 0x00,
|
None = 0x00,
|
||||||
Sight = 0x01,
|
Sight = 0x01,
|
||||||
Scent = 0x02,
|
Scent = 0x02,
|
||||||
Sound = 0x04,
|
Sound = 0x04,
|
||||||
LowHp = 0x08,
|
LowHp = 0x08,
|
||||||
IgnoreLevelDifference = 0x10
|
IgnoreLevelDifference = 0x10,
|
||||||
|
Magic = 0x20,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum KindredType
|
enum KindredType
|
||||||
@ -49,7 +50,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
class BattleNpc : Npc
|
class BattleNpc : Npc
|
||||||
{
|
{
|
||||||
public HateContainer hateContainer;
|
public HateContainer hateContainer;
|
||||||
public AggroType aggroType;
|
public DetectionType detectionType;
|
||||||
public KindredType kindredType;
|
public KindredType kindredType;
|
||||||
public bool neutral;
|
public bool neutral;
|
||||||
private uint despawnTime;
|
private uint despawnTime;
|
||||||
@ -82,7 +83,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
spawnZ = posZ;
|
spawnZ = posZ;
|
||||||
|
|
||||||
// todo: read these from db also
|
// todo: read these from db also
|
||||||
aggroType = AggroType.Sight;
|
detectionType = DetectionType.Sight;
|
||||||
this.moveState = 2;
|
this.moveState = 2;
|
||||||
ResetMoveSpeeds();
|
ResetMoveSpeeds();
|
||||||
despawnTime = 10;
|
despawnTime = 10;
|
||||||
@ -113,14 +114,14 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return subpackets;
|
return subpackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetAggroType()
|
public uint GetDetectionType()
|
||||||
{
|
{
|
||||||
return (uint)aggroType;
|
return (uint)detectionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAggroType(uint aggroType)
|
public void SetDetectionType(uint detectionType)
|
||||||
{
|
{
|
||||||
this.aggroType = (AggroType)aggroType;
|
this.detectionType = (DetectionType)detectionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(DateTime tick)
|
public override void Update(DateTime tick)
|
||||||
|
@ -1,32 +1,39 @@
|
|||||||
/*
|
-- MySQL dump 10.13 Distrib 5.7.18, for Win64 (x86_64)
|
||||||
MySQL Data Transfer
|
--
|
||||||
Source Host: localhost
|
-- Host: localhost Database: ffxiv_server
|
||||||
Source Database: ffxiv_server
|
-- ------------------------------------------------------
|
||||||
Target Host: localhost
|
-- Server version 5.7.18-log
|
||||||
Target Database: ffxiv_server
|
|
||||||
Date: 5/1/2017 10:28:15 PM
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
*/
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8 */;
|
||||||
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||||
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||||
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `server_battlenpc_groups`
|
||||||
|
--
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS=0;
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for server_battlenpc_groups
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `server_battlenpc_groups`;
|
DROP TABLE IF EXISTS `server_battlenpc_groups`;
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
CREATE TABLE `server_battlenpc_groups` (
|
CREATE TABLE `server_battlenpc_groups` (
|
||||||
`groupId` int(10) unsigned NOT NULL DEFAULT '0',
|
`groupId` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`genusId` int(10) unsigned NOT NULL DEFAULT '0',
|
`poolId` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`actorClassId` int(10) unsigned NOT NULL,
|
`actorClassId` int(10) unsigned NOT NULL,
|
||||||
|
`scriptName` varchar(50) NOT NULL,
|
||||||
`minLevel` tinyint(3) unsigned NOT NULL DEFAULT '1',
|
`minLevel` tinyint(3) unsigned NOT NULL DEFAULT '1',
|
||||||
`maxLevel` tinyint(3) unsigned NOT NULL DEFAULT '1',
|
`maxLevel` tinyint(3) unsigned NOT NULL DEFAULT '1',
|
||||||
`respawnTime` int(10) unsigned NOT NULL DEFAULT '10',
|
`respawnTime` int(10) unsigned NOT NULL DEFAULT '10',
|
||||||
`hp` int(10) unsigned NOT NULL DEFAULT '0',
|
`hp` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`mp` int(10) unsigned NOT NULL DEFAULT '0',
|
`mp` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`skillListId` int(10) unsigned NOT NULL DEFAULT '0',
|
|
||||||
`spellListId` int(10) unsigned NOT NULL DEFAULT '0',
|
|
||||||
`dropListId` int(10) unsigned NOT NULL DEFAULT '0',
|
`dropListId` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`allegiance` int(10) unsigned NOT NULL DEFAULT '0',
|
`allegiance` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||||
`spawnType` smallint(5) unsigned NOT NULL DEFAULT '0',
|
`spawnType` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||||
`animationId` int(10) unsigned NOT NULL DEFAULT '0',
|
`animationId` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`actorState` smallint(5) unsigned NOT NULL DEFAULT '0',
|
`actorState` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||||
@ -34,4 +41,28 @@ CREATE TABLE `server_battlenpc_groups` (
|
|||||||
`privateAreaLevel` int(11) NOT NULL DEFAULT '0',
|
`privateAreaLevel` int(11) NOT NULL DEFAULT '0',
|
||||||
`zoneId` smallint(3) unsigned NOT NULL,
|
`zoneId` smallint(3) unsigned NOT NULL,
|
||||||
PRIMARY KEY (`groupId`)
|
PRIMARY KEY (`groupId`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `server_battlenpc_groups`
|
||||||
|
--
|
||||||
|
|
||||||
|
LOCK TABLES `server_battlenpc_groups` WRITE;
|
||||||
|
/*!40000 ALTER TABLE `server_battlenpc_groups` DISABLE KEYS */;
|
||||||
|
set autocommit=0;
|
||||||
|
INSERT INTO `server_battlenpc_groups` VALUES (1,1,2104001,'wharf_rat',1,1,10,0,0,0,0,0,0,0,'',0,170);
|
||||||
|
/*!40000 ALTER TABLE `server_battlenpc_groups` ENABLE KEYS */;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
commit;
|
||||||
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||||
|
|
||||||
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||||
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
|
-- Dump completed on 2017-09-07 21:54:42
|
||||||
|
64
sql/server_battlenpc_pools.sql
Normal file
64
sql/server_battlenpc_pools.sql
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
-- MySQL dump 10.13 Distrib 5.7.18, for Win64 (x86_64)
|
||||||
|
--
|
||||||
|
-- Host: localhost Database: ffxiv_server
|
||||||
|
-- ------------------------------------------------------
|
||||||
|
-- Server version 5.7.18-log
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8 */;
|
||||||
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||||
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||||
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `server_battlenpc_pools`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `server_battlenpc_pools`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `server_battlenpc_pools` (
|
||||||
|
`poolId` int(10) unsigned NOT NULL,
|
||||||
|
`actorClassId` int(10) unsigned NOT NULL,
|
||||||
|
`name` varchar(50) NOT NULL,
|
||||||
|
`genusId` int(10) unsigned NOT NULL,
|
||||||
|
`currentJob` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`combatSkill` tinyint(3) unsigned NOT NULL,
|
||||||
|
`combatDelay` smallint(5) unsigned NOT NULL,
|
||||||
|
`combatDmgMult` float unsigned NOT NULL DEFAULT '1',
|
||||||
|
`aggroType` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`immunity` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`linkType` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`spellListId` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`skillListId` int(10) unsigned NOT NULL,
|
||||||
|
PRIMARY KEY (`poolId`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `server_battlenpc_pools`
|
||||||
|
--
|
||||||
|
|
||||||
|
LOCK TABLES `server_battlenpc_pools` WRITE;
|
||||||
|
/*!40000 ALTER TABLE `server_battlenpc_pools` DISABLE KEYS */;
|
||||||
|
set autocommit=0;
|
||||||
|
INSERT INTO `server_battlenpc_pools` VALUES (1,2104001,'wharf_rat',12,0,1,4200,1,0,0,0,0,0);
|
||||||
|
/*!40000 ALTER TABLE `server_battlenpc_pools` ENABLE KEYS */;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
commit;
|
||||||
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||||
|
|
||||||
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||||
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
|
-- Dump completed on 2017-09-07 21:54:45
|
@ -24,7 +24,6 @@ DROP TABLE IF EXISTS `server_battlenpc_spawn_locations`;
|
|||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
CREATE TABLE `server_battlenpc_spawn_locations` (
|
CREATE TABLE `server_battlenpc_spawn_locations` (
|
||||||
`bnpcIndex` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`bnpcIndex` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`uniqueId` varchar(32) NOT NULL DEFAULT '',
|
|
||||||
`customDisplayName` varchar(32) NOT NULL DEFAULT '',
|
`customDisplayName` varchar(32) NOT NULL DEFAULT '',
|
||||||
`groupId` int(10) unsigned NOT NULL,
|
`groupId` int(10) unsigned NOT NULL,
|
||||||
`positionX` float NOT NULL,
|
`positionX` float NOT NULL,
|
||||||
@ -42,8 +41,8 @@ CREATE TABLE `server_battlenpc_spawn_locations` (
|
|||||||
LOCK TABLES `server_battlenpc_spawn_locations` WRITE;
|
LOCK TABLES `server_battlenpc_spawn_locations` WRITE;
|
||||||
/*!40000 ALTER TABLE `server_battlenpc_spawn_locations` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `server_battlenpc_spawn_locations` DISABLE KEYS */;
|
||||||
set autocommit=0;
|
set autocommit=0;
|
||||||
INSERT INTO `server_battlenpc_spawn_locations` VALUES (1,'wharf_rat','test',1,25.584,200,-450,-2.514);
|
INSERT INTO `server_battlenpc_spawn_locations` VALUES (1,'test',1,25.584,200,-450,-2.514);
|
||||||
INSERT INTO `server_battlenpc_spawn_locations` VALUES (2,'wharf_rat','test',1,20,200,-444,-3.14);
|
INSERT INTO `server_battlenpc_spawn_locations` VALUES (2,'test',1,20,200,-444,-3.14);
|
||||||
/*!40000 ALTER TABLE `server_battlenpc_spawn_locations` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `server_battlenpc_spawn_locations` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
commit;
|
commit;
|
||||||
@ -57,4 +56,4 @@ commit;
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2017-09-06 0:07:11
|
-- Dump completed on 2017-09-07 21:54:41
|
||||||
|
Loading…
Reference in New Issue
Block a user