1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-25 14:17:46 +00:00

accidentally mass replaced "target", fixed now

This commit is contained in:
Tahir Akhlaq 2016-06-15 04:20:24 +01:00
parent 884a26dc52
commit 2b81660dce
10 changed files with 733 additions and 733 deletions

View file

@ -16,22 +16,22 @@
See https://github.com/nlog/nlog/wiki/Configuration-file See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs. for information on customizing logging rules and outputs.
--> -->
<tarGets async="true"> <targets async="true">
<!-- <!--
add your tarGets here add your targets here
See https://github.com/nlog/NLog/wiki/TarGets for possible tarGets. See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers. See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
--> -->
<!-- <!--
Write events to a file with the date in the filename. Write events to a file with the date in the filename.
<tarGet xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log" <target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" /> layout="${longdate} ${uppercase:${level}} ${message}" />
--> -->
<tarGet xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" /> <target xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" />
<tarGet xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/lobby.log" layout="[${longdate}] [${uppercase:${level}}] ${message}" /> <target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/lobby.log" layout="[${longdate}] [${uppercase:${level}}] ${message}" />
</tarGets> </targets>
<rules> <rules>
<!-- add your logging rules here --> <!-- add your logging rules here -->

File diff suppressed because it is too large Load diff

View file

@ -213,7 +213,7 @@ namespace FFXIVClassic_Lobby_Server
{ {
BasePacket newPacket = null; BasePacket newPacket = null;
//Too small to even Get length //Too small to even get length
if (bytesRead <= offset) if (bytesRead <= offset)
return null; return null;

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Cyotek.CircularBuffer" version="1.0.0.0" tarGetFramework="net45" /> <package id="Cyotek.CircularBuffer" version="1.0.0.0" targetFramework="net45" />
<package id="Dapper" version="1.42" tarGetFramework="net45" /> <package id="Dapper" version="1.42" targetFramework="net45" />
<package id="MySql.Data" version="6.9.7" tarGetFramework="net45" /> <package id="MySql.Data" version="6.9.7" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" tarGetFramework="net45" /> <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="NLog" version="4.3.4" tarGetFramework="net45" /> <package id="NLog" version="4.3.4" targetFramework="net45" />
<package id="NLog.Config" version="4.3.4" tarGetFramework="net45" /> <package id="NLog.Config" version="4.3.4" targetFramework="net45" />
<package id="NLog.Schema" version="4.3.4" tarGetFramework="net45" /> <package id="NLog.Schema" version="4.3.4" targetFramework="net45" />
</packages> </packages>

View file

@ -90,14 +90,14 @@ namespace FFXIVClassic_Lobby_Server.packets
header.subpacketSize = (ushort)(SUBPACKET_SIZE + GAMEMESSAGE_SIZE + data.Length); header.subpacketSize = (ushort)(SUBPACKET_SIZE + GAMEMESSAGE_SIZE + data.Length);
} }
public SubPacket(SubPacket original, uint newTarGetId) public SubPacket(SubPacket original, uint newTargetId)
{ {
this.header = new SubPacketHeader(); this.header = new SubPacketHeader();
this.gameMessage = original.gameMessage; this.gameMessage = original.gameMessage;
header.subpacketSize = original.header.subpacketSize; header.subpacketSize = original.header.subpacketSize;
header.type = original.header.type; header.type = original.header.type;
header.sourceId = original.header.sourceId; header.sourceId = original.header.sourceId;
header.targetId = newTarGetId; header.targetId = newTargetId;
data = original.data; data = original.data;
} }

View file

@ -16,22 +16,22 @@
See https://github.com/nlog/nlog/wiki/Configuration-file See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs. for information on customizing logging rules and outputs.
--> -->
<tarGets async="true"> <targets async="true">
<!-- <!--
add your tarGets here add your targets here
See https://github.com/nlog/NLog/wiki/TarGets for possible tarGets. See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers. See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
--> -->
<!-- <!--
Write events to a file with the date in the filename. Write events to a file with the date in the filename.
<tarGet xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log" <target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" /> layout="${longdate} ${uppercase:${level}} ${message}" />
--> -->
<tarGet xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" /> <target xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" />
<tarGet xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/map.log" layout="[${longdate}] [${uppercase:${level}}] ${message}"/> <target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/map.log" layout="[${longdate}] [${uppercase:${level}}] ${message}"/>
</tarGets> </targets>
<rules> <rules>
<!-- add your logging rules here --> <!-- add your logging rules here -->

File diff suppressed because it is too large Load diff

View file

@ -296,7 +296,7 @@ namespace FFXIVClassic_Map_Server
{ {
BasePacket newPacket = null; BasePacket newPacket = null;
//Too small to even Get length //Too small to even get length
if (bytesRead <= offset) if (bytesRead <= offset)
return null; return null;

View file

@ -1,354 +1,354 @@
using FFXIVClassic_Map_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.actors; using FFXIVClassic_Map_Server.actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.actor.events; using FFXIVClassic_Map_Server.packets.send.actor.events;
using FFXIVClassic.Common; using FFXIVClassic.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using FFXIVClassic_Map_Server.actors.area; using FFXIVClassic_Map_Server.actors.area;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {
class Actor class Actor
{ {
public uint actorId; public uint actorId;
public string actorName; public string actorName;
public uint displayNameId = 0xFFFFFFFF; public uint displayNameId = 0xFFFFFFFF;
public string customDisplayName; public string customDisplayName;
public ushort currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE; public ushort currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE;
public ushort currentSubState = SetActorStatePacket.SUB_STATE_NONE; public ushort currentSubState = SetActorStatePacket.SUB_STATE_NONE;
public float positionX, positionY, positionZ, rotation; public float positionX, positionY, positionZ, rotation;
public float oldPositionX, oldPositionY, oldPositionZ, oldRotation; public float oldPositionX, oldPositionY, oldPositionZ, oldRotation;
public ushort moveState, oldMoveState; public ushort moveState, oldMoveState;
public float[] moveSpeeds = new float[5]; public float[] moveSpeeds = new float[5];
public uint zoneId; public uint zoneId;
public Area zone = null; public Area zone = null;
public bool isZoning = false; public bool isZoning = false;
public bool spawnedFirstTime = false; public bool spawnedFirstTime = false;
public string classPath; public string classPath;
public string className; public string className;
public List<LuaParam> classParams; public List<LuaParam> classParams;
public EventList eventConditions; public EventList eventConditions;
public Actor(uint actorId) public Actor(uint actorId)
{ {
this.actorId = actorId; this.actorId = actorId;
} }
public Actor(uint actorId, string actorName, string className, List<LuaParam> classParams) public Actor(uint actorId, string actorName, string className, List<LuaParam> classParams)
{ {
this.actorId = actorId; this.actorId = actorId;
this.actorName = actorName; this.actorName = actorName;
this.className = className; this.className = className;
this.classParams = classParams; this.classParams = classParams;
this.moveSpeeds[0] = SetActorSpeedPacket.DEFAULT_STOP; this.moveSpeeds[0] = SetActorSpeedPacket.DEFAULT_STOP;
this.moveSpeeds[1] = SetActorSpeedPacket.DEFAULT_WALK; this.moveSpeeds[1] = SetActorSpeedPacket.DEFAULT_WALK;
this.moveSpeeds[2] = SetActorSpeedPacket.DEFAULT_RUN; this.moveSpeeds[2] = SetActorSpeedPacket.DEFAULT_RUN;
this.moveSpeeds[3] = SetActorSpeedPacket.DEFAULT_RUN; this.moveSpeeds[3] = SetActorSpeedPacket.DEFAULT_RUN;
} }
public SubPacket CreateAddActorPacket(uint playerActorId, byte val) public SubPacket CreateAddActorPacket(uint playerActorId, byte val)
{ {
return AddActorPacket.BuildPacket(actorId, playerActorId, val); return AddActorPacket.BuildPacket(actorId, playerActorId, val);
} }
public SubPacket CreateNamePacket(uint playerActorId) public SubPacket CreateNamePacket(uint playerActorId)
{ {
return SetActorNamePacket.BuildPacket(actorId, playerActorId, displayNameId, displayNameId == 0xFFFFFFFF | displayNameId == 0x0 ? customDisplayName : ""); return SetActorNamePacket.BuildPacket(actorId, playerActorId, displayNameId, displayNameId == 0xFFFFFFFF | displayNameId == 0x0 ? customDisplayName : "");
} }
public SubPacket CreateSpeedPacket(uint playerActorId) public SubPacket CreateSpeedPacket(uint playerActorId)
{ {
return SetActorSpeedPacket.BuildPacket(actorId, playerActorId); return SetActorSpeedPacket.BuildPacket(actorId, playerActorId);
} }
public SubPacket CreateSpawnPositonPacket(uint playerActorId, uint spawnType) public SubPacket CreateSpawnPositonPacket(uint playerActorId, uint spawnType)
{ {
SubPacket spawnPacket; SubPacket spawnPacket;
if (!spawnedFirstTime && playerActorId == actorId) if (!spawnedFirstTime && playerActorId == actorId)
spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, 0x1, false); spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, 0x1, false);
else if (playerActorId == actorId) else if (playerActorId == actorId)
spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, true); spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, true);
else else
{ {
if (this is Player) if (this is Player)
spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, spawnType, false); spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, spawnType, false);
else else
spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, actorId, positionX, positionY, positionZ, rotation, spawnType, false); spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, actorId, positionX, positionY, positionZ, rotation, spawnType, false);
} }
//return SetActorPositionPacket.BuildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE); //return SetActorPositionPacket.BuildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
spawnedFirstTime = true; spawnedFirstTime = true;
return spawnPacket; return spawnPacket;
} }
public SubPacket CreateSpawnTeleportPacket(uint playerActorId, uint spawnType) public SubPacket CreateSpawnTeleportPacket(uint playerActorId, uint spawnType)
{ {
SubPacket spawnPacket; SubPacket spawnPacket;
spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, false); spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, false);
//return SetActorPositionPacket.BuildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE); //return SetActorPositionPacket.BuildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
spawnPacket.DebugPrintSubPacket(); spawnPacket.DebugPrintSubPacket();
return spawnPacket; return spawnPacket;
} }
public SubPacket CreatePositionUpdatePacket(uint playerActorId) public SubPacket CreatePositionUpdatePacket(uint playerActorId)
{ {
return MoveActorToPositionPacket.BuildPacket(actorId, playerActorId, positionX, positionY, positionZ, rotation, moveState); return MoveActorToPositionPacket.BuildPacket(actorId, playerActorId, positionX, positionY, positionZ, rotation, moveState);
} }
public SubPacket CreateStatePacket(uint playerActorID) public SubPacket CreateStatePacket(uint playerActorID)
{ {
return SetActorStatePacket.BuildPacket(actorId, playerActorID, currentMainState, currentSubState); return SetActorStatePacket.BuildPacket(actorId, playerActorID, currentMainState, currentSubState);
} }
public List<SubPacket> GetEventConditionPackets(uint playerActorId) public List<SubPacket> GetEventConditionPackets(uint playerActorId)
{ {
List<SubPacket> subpackets = new List<SubPacket>(); List<SubPacket> subpackets = new List<SubPacket>();
//Return empty list //Return empty list
if (eventConditions == null) if (eventConditions == null)
return subpackets; return subpackets;
if (eventConditions.talkEventConditions != null) if (eventConditions.talkEventConditions != null)
{ {
foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions) foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions)
subpackets.Add(SetTalkEventCondition.BuildPacket(playerActorId, actorId, condition)); subpackets.Add(SetTalkEventCondition.BuildPacket(playerActorId, actorId, condition));
} }
if (eventConditions.noticeEventConditions != null) if (eventConditions.noticeEventConditions != null)
{ {
foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions) foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions)
subpackets.Add(SetNoticeEventCondition.BuildPacket(playerActorId, actorId, condition)); subpackets.Add(SetNoticeEventCondition.BuildPacket(playerActorId, actorId, condition));
} }
if (eventConditions.emoteEventConditions != null) if (eventConditions.emoteEventConditions != null)
{ {
foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions) foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions)
subpackets.Add(SetEmoteEventCondition.BuildPacket(playerActorId, actorId, condition)); subpackets.Add(SetEmoteEventCondition.BuildPacket(playerActorId, actorId, condition));
} }
if (eventConditions.pushWithCircleEventConditions != null) if (eventConditions.pushWithCircleEventConditions != null)
{ {
foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions) foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions)
subpackets.Add(SetPushEventConditionWithCircle.BuildPacket(playerActorId, actorId, condition)); subpackets.Add(SetPushEventConditionWithCircle.BuildPacket(playerActorId, actorId, condition));
} }
if (eventConditions.pushWithFanEventConditions != null) if (eventConditions.pushWithFanEventConditions != null)
{ {
foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions) foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions)
subpackets.Add(SetPushEventConditionWithFan.BuildPacket(playerActorId, actorId, condition)); subpackets.Add(SetPushEventConditionWithFan.BuildPacket(playerActorId, actorId, condition));
} }
if (eventConditions.pushWithBoxEventConditions != null) if (eventConditions.pushWithBoxEventConditions != null)
{ {
foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions) foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions)
subpackets.Add(SetPushEventConditionWithTriggerBox.BuildPacket(playerActorId, actorId, condition)); subpackets.Add(SetPushEventConditionWithTriggerBox.BuildPacket(playerActorId, actorId, condition));
} }
return subpackets; return subpackets;
} }
public BasePacket GetSetEventStatusPackets(uint playerActorId) public BasePacket GetSetEventStatusPackets(uint playerActorId)
{ {
List<SubPacket> subpackets = new List<SubPacket>(); List<SubPacket> subpackets = new List<SubPacket>();
//Return empty list //Return empty list
if (eventConditions == null) if (eventConditions == null)
return BasePacket.CreatePacket(subpackets, true, false); return BasePacket.CreatePacket(subpackets, true, false);
if (eventConditions.talkEventConditions != null) if (eventConditions.talkEventConditions != null)
{ {
foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions) foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions)
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 1, condition.conditionName)); subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 1, condition.conditionName));
} }
if (eventConditions.noticeEventConditions != null) if (eventConditions.noticeEventConditions != null)
{ {
foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions) foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions)
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 1, condition.conditionName)); subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 1, condition.conditionName));
} }
if (eventConditions.emoteEventConditions != null) if (eventConditions.emoteEventConditions != null)
{ {
foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions) foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions)
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 3, condition.conditionName)); subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 3, condition.conditionName));
} }
if (eventConditions.pushWithCircleEventConditions != null) if (eventConditions.pushWithCircleEventConditions != null)
{ {
foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions) foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions)
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName)); subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName));
} }
if (eventConditions.pushWithFanEventConditions != null) if (eventConditions.pushWithFanEventConditions != null)
{ {
foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions) foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions)
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName)); subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName));
} }
if (eventConditions.pushWithBoxEventConditions != null) if (eventConditions.pushWithBoxEventConditions != null)
{ {
foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions) foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions)
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName)); subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName));
} }
return BasePacket.CreatePacket(subpackets, true, false); return BasePacket.CreatePacket(subpackets, true, false);
} }
public SubPacket CreateIsZoneingPacket(uint playerActorId) public SubPacket CreateIsZoneingPacket(uint playerActorId)
{ {
return SetActorIsZoningPacket.BuildPacket(actorId, playerActorId, false); return SetActorIsZoningPacket.BuildPacket(actorId, playerActorId, false);
} }
public virtual SubPacket CreateScriptBindPacket(uint playerActorId) public virtual SubPacket CreateScriptBindPacket(uint playerActorId)
{ {
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, classParams); return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, classParams);
} }
public virtual BasePacket GetSpawnPackets(uint playerActorId) public virtual BasePacket GetSpawnPackets(uint playerActorId)
{ {
return GetSpawnPackets(playerActorId, 0x1); return GetSpawnPackets(playerActorId, 0x1);
} }
public virtual BasePacket GetSpawnPackets(uint playerActorId, uint spawnType) public virtual BasePacket GetSpawnPackets(uint playerActorId, uint spawnType)
{ {
List<SubPacket> subpackets = new List<SubPacket>(); List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(CreateAddActorPacket(playerActorId, 8)); subpackets.Add(CreateAddActorPacket(playerActorId, 8));
subpackets.AddRange(GetEventConditionPackets(playerActorId)); subpackets.AddRange(GetEventConditionPackets(playerActorId));
subpackets.Add(CreateSpeedPacket(playerActorId)); subpackets.Add(CreateSpeedPacket(playerActorId));
subpackets.Add(CreateSpawnPositonPacket(playerActorId, spawnType)); subpackets.Add(CreateSpawnPositonPacket(playerActorId, spawnType));
subpackets.Add(CreateNamePacket(playerActorId)); subpackets.Add(CreateNamePacket(playerActorId));
subpackets.Add(CreateStatePacket(playerActorId)); subpackets.Add(CreateStatePacket(playerActorId));
subpackets.Add(CreateIsZoneingPacket(playerActorId)); subpackets.Add(CreateIsZoneingPacket(playerActorId));
subpackets.Add(CreateScriptBindPacket(playerActorId)); subpackets.Add(CreateScriptBindPacket(playerActorId));
return BasePacket.CreatePacket(subpackets, true, false); return BasePacket.CreatePacket(subpackets, true, false);
} }
public virtual BasePacket GetInitPackets(uint playerActorId) public virtual BasePacket GetInitPackets(uint playerActorId)
{ {
SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init"); SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init");
initProperties.AddByte(0xE14B0CA8, 1); initProperties.AddByte(0xE14B0CA8, 1);
initProperties.AddByte(0x2138FD71, 1); initProperties.AddByte(0x2138FD71, 1);
initProperties.AddByte(0xFBFBCFB1, 1); initProperties.AddByte(0xFBFBCFB1, 1);
initProperties.AddTarget(); initProperties.AddTarget();
return BasePacket.CreatePacket(initProperties.BuildPacket(playerActorId, actorId), true, false); return BasePacket.CreatePacket(initProperties.BuildPacket(playerActorId, actorId), true, false);
} }
public override bool Equals(Object obj) public override bool Equals(Object obj)
{ {
Actor actorObj = obj as Actor; Actor actorObj = obj as Actor;
if (actorObj == null) if (actorObj == null)
return false; return false;
else else
return actorId == actorObj.actorId; return actorId == actorObj.actorId;
} }
public string GetName() public string GetName()
{ {
return actorName; return actorName;
} }
public string GetClassName() public string GetClassName()
{ {
return className; return className;
} }
public ushort GetState() public ushort GetState()
{ {
return currentMainState; return currentMainState;
} }
public List<LuaParam> GetLuaParams() public List<LuaParam> GetLuaParams()
{ {
return classParams; return classParams;
} }
public void ChangeState(ushort newState) public void ChangeState(ushort newState)
{ {
currentMainState = newState; currentMainState = newState;
SubPacket ChangeStatePacket = SetActorStatePacket.BuildPacket(actorId, actorId, newState, currentSubState); SubPacket ChangeStatePacket = SetActorStatePacket.BuildPacket(actorId, actorId, newState, currentSubState);
SubPacket battleActionPacket = BattleAction1Packet.BuildPacket(actorId, actorId); SubPacket battleActionPacket = BattleAction1Packet.BuildPacket(actorId, actorId);
zone.BroadcastPacketAroundActor(this, ChangeStatePacket); zone.BroadcastPacketAroundActor(this, ChangeStatePacket);
zone.BroadcastPacketAroundActor(this, battleActionPacket); zone.BroadcastPacketAroundActor(this, battleActionPacket);
} }
public void ChangeSpeed(int type, float value) public void ChangeSpeed(int type, float value)
{ {
moveSpeeds[type] = value; moveSpeeds[type] = value;
SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2]); SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2]);
zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket); zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket);
} }
public void ChangeSpeed(float speedStop, float speedWalk, float speedRun) public void ChangeSpeed(float speedStop, float speedWalk, float speedRun)
{ {
moveSpeeds[0] = speedStop; moveSpeeds[0] = speedStop;
moveSpeeds[1] = speedWalk; moveSpeeds[1] = speedWalk;
moveSpeeds[2] = speedRun; moveSpeeds[2] = speedRun;
moveSpeeds[3] = speedRun; moveSpeeds[3] = speedRun;
SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2]); SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2]);
zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket); zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket);
} }
public void generateActorName(int actorNumber) public void generateActorName(int actorNumber)
{ {
//Format Class Name //Format Class Name
string className = this.className.Replace("Populace", "Ppl") string className = this.className.Replace("Populace", "Ppl")
.Replace("Monster", "Mon") .Replace("Monster", "Mon")
.Replace("Crowd", "Crd") .Replace("Crowd", "Crd")
.Replace("MapObj", "Map") .Replace("MapObj", "Map")
.Replace("Object", "Obj") .Replace("Object", "Obj")
.Replace("Retainer", "Rtn") .Replace("Retainer", "Rtn")
.Replace("Standard", "Std"); .Replace("Standard", "Std");
className = Char.ToLowerInvariant(className[0]) + className.Substring(1); className = Char.ToLowerInvariant(className[0]) + className.Substring(1);
//Format Zone Name //Format Zone Name
string zoneName = zone.zoneName.Replace("Field", "Fld") string zoneName = zone.zoneName.Replace("Field", "Fld")
.Replace("Dungeon", "Dgn") .Replace("Dungeon", "Dgn")
.Replace("Town", "Twn") .Replace("Town", "Twn")
.Replace("Battle", "Btl") .Replace("Battle", "Btl")
.Replace("Test", "Tes") .Replace("Test", "Tes")
.Replace("Event", "Evt") .Replace("Event", "Evt")
.Replace("Ship", "Shp") .Replace("Ship", "Shp")
.Replace("Office", "Ofc"); .Replace("Office", "Ofc");
if (zone is PrivateArea) if (zone is PrivateArea)
{ {
//Check if "normal" //Check if "normal"
zoneName = zoneName.Remove(zoneName.Length - 1, 1) + "P"; zoneName = zoneName.Remove(zoneName.Length - 1, 1) + "P";
} }
zoneName = Char.ToLowerInvariant(zoneName[0]) + zoneName.Substring(1); zoneName = Char.ToLowerInvariant(zoneName[0]) + zoneName.Substring(1);
try try
{ {
className = className.Substring(0, 20 - zoneName.Length); className = className.Substring(0, 20 - zoneName.Length);
} }
catch (ArgumentOutOfRangeException e) catch (ArgumentOutOfRangeException e)
{} {}
//Convert actor number to base 63 //Convert actor number to base 63
string classNumber = Utils.ToStringBase63(actorNumber); string classNumber = Utils.ToStringBase63(actorNumber);
//Get stuff after @ //Get stuff after @
uint zoneId = zone.actorId; uint zoneId = zone.actorId;
uint privLevel = 0; uint privLevel = 0;
if (zone is PrivateArea) if (zone is PrivateArea)
privLevel = ((PrivateArea)zone).GetPrivateAreaLevel(); privLevel = ((PrivateArea)zone).GetPrivateAreaLevel();
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel); actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
} }
} }
} }

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Cyotek.CircularBuffer" version="1.0.0.0" tarGetFramework="net45" /> <package id="Cyotek.CircularBuffer" version="1.0.0.0" targetFramework="net45" />
<package id="Dapper" version="1.42" tarGetFramework="net45" /> <package id="Dapper" version="1.42" targetFramework="net45" />
<package id="MoonSharp" version="1.2.1.0" tarGetFramework="net45" /> <package id="MoonSharp" version="1.2.1.0" targetFramework="net45" />
<package id="MySql.Data" version="6.9.7" tarGetFramework="net45" /> <package id="MySql.Data" version="6.9.7" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" tarGetFramework="net45" /> <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="NLog" version="4.3.5" tarGetFramework="net45" /> <package id="NLog" version="4.3.5" targetFramework="net45" />
<package id="NLog.Config" version="4.3.5" tarGetFramework="net45" /> <package id="NLog.Config" version="4.3.5" targetFramework="net45" />
<package id="NLog.Schema" version="4.3.4" tarGetFramework="net45" /> <package id="NLog.Schema" version="4.3.4" targetFramework="net45" />
</packages> </packages>