mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Merge branch 'ioncannon/quest_system' into Jorge/quest_system
This commit is contained in:
commit
4e5a07afa4
@ -1,84 +0,0 @@
|
||||
--[[
|
||||
|
||||
PopulaceSpecialEventCryer Script
|
||||
|
||||
Actor Class script to handle the 6 NPCs (technically 3, the actors were duped) involved in the Foundation Day 2011 & 2012 events.
|
||||
In 2011 they appear to be used for recruitment information for their respective Grand Company.
|
||||
In 2012, they were used for exchanging Over-aspected Crystals/Clusters for GC seals as part of the ongoing Atomos event.
|
||||
|
||||
Functions:
|
||||
|
||||
For 2011.
|
||||
eventTalkStep0(joined) - NPC dialog about joining their cause to fight back Imperials. joined = 0 or 1. Function has hardcoded actor IDs, won't work with 2012 versions
|
||||
eventTalkNotGCmenber(npcGC) - NPC dialog when you're not part of their grand company.
|
||||
|
||||
For 2012.
|
||||
eventTalkCrystalExchange(player, npcGC, hasCrystal) - NPC dialog explaining they want over-aspected crystals. Brings up crystal exchange prompt if hasCrystal = 1.
|
||||
eventTalkCsOverflow(player, npcGC) - Error message that you can't hold the seals being offered.
|
||||
eventTalkCrystalExchange2(player, npcGC) - NPC dialog for accepting exchange of crystals for seals
|
||||
|
||||
--]]
|
||||
|
||||
require ("global")
|
||||
|
||||
function init(npc)
|
||||
return false, false, 0, 0;
|
||||
end
|
||||
|
||||
|
||||
local gcRep = {
|
||||
[1001619] = 1, -- Maelstrom Representative 2011
|
||||
[1002105] = 1, -- Maelstrom Representative 2012
|
||||
[1001623] = 2, -- Adder Representative 2011
|
||||
[1002109] = 2, -- Adder Representative 2012
|
||||
[1001627] = 3, -- Flame Representative 2011
|
||||
[1002113] = 3, -- Flame Representative 2012
|
||||
}
|
||||
|
||||
|
||||
function onEventStarted(player, npc, triggerName)
|
||||
local playerGC = player.gcCurrent;
|
||||
local npcId = npc:GetActorClassId();
|
||||
local npcGC = gcRep[npcId];
|
||||
local npcGCSeal = 1000200 + npcGC;
|
||||
local hasCrystal = 1;
|
||||
local crystal = 3020537;
|
||||
local cluster = 3020413;
|
||||
local eventMode = 2012;
|
||||
|
||||
|
||||
if eventMode == 2011 then
|
||||
if playerGC == 0 then
|
||||
callClientFunction(player, "eventTalkStep0", 0);
|
||||
elseif playerGC == npcGC then
|
||||
callClientFunction(player, "eventTalkStep0", 1);
|
||||
else
|
||||
callClientFunction(player, "eventTalkNotGCmenber", npcGC);
|
||||
end
|
||||
|
||||
elseif eventMode == 2012 then
|
||||
choice = callClientFunction(player, "eventTalkCrystalExchange", player, npcGC, hasCrystal);
|
||||
|
||||
if choice == 1 then
|
||||
--callClientFunction(player, "eventTalkCsOverflow", player, npcGC);
|
||||
player:SendMessage(0x20, "", "You pretend to hand over four over-aspected crystals.");
|
||||
callClientFunction(player, "eventTalkCrystalExchange2", player, npcGC);
|
||||
|
||||
local invCheck = player:GetItemPackage(INVENTORY_CURRENCY):AddItem(npcGCSeal, 1000, 1);
|
||||
if invCheck == INV_ERROR_SUCCESS then
|
||||
player:SendGameMessage(player, GetWorldMaster(), 25071, MESSAGE_TYPE_SYSTEM, crystal, 1, npcGCSeal, 1, 4, 1000);
|
||||
end
|
||||
elseif choice == 2 then
|
||||
player:SendMessage(0x20, "", "You pretend to hand over an over-aspected cluster.");
|
||||
--callClientFunction(player, "eventTalkCsOverflow", player, npcGC);
|
||||
callClientFunction(player, "eventTalkCrystalExchange2", player, npcGC);
|
||||
|
||||
local invCheck = player:GetItemPackage(INVENTORY_CURRENCY):AddItem(npcGCSeal, 3000, 1);
|
||||
if invCheck == INV_ERROR_SUCCESS then
|
||||
player:SendGameMessage(player, GetWorldMaster(), 25071, MESSAGE_TYPE_SYSTEM, cluster, 1, npcGCSeal, 1, 1, 3000);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
player:EndEvent();
|
||||
end
|
@ -23,16 +23,18 @@ function onTrigger(player, argc, animation, regionId, layoutId, maxLayoutId)
|
||||
end
|
||||
|
||||
local pos = player:GetPos();
|
||||
local x = pos[0];
|
||||
local y = pos[1];
|
||||
local z = pos[2];
|
||||
local zone = pos[4];
|
||||
local x = pos[1];
|
||||
local y = pos[2];
|
||||
local z = pos[3];
|
||||
local zone = pos[5];
|
||||
|
||||
actorClassId = tonumber(actorClassId);
|
||||
|
||||
if (actorClassId ~= nil) then
|
||||
zone = player:GetZone();
|
||||
actor = zone:SpawnActor(actorClassId, "mapobj", pos[0], pos[1], pos[2], tonumber(regionId), tonumber(layoutId));
|
||||
actor = zone:SpawnActor(actorClassId, "mapobj", pos[1], pos[2], pos[3], tonumber(regionId), tonumber(layoutId));
|
||||
|
||||
print("test");
|
||||
wait(0.8);
|
||||
actor:PlayMapObjAnimation(player, animation);
|
||||
zone:DespawnActor("mapobj");
|
||||
|
@ -20,8 +20,8 @@ function onBeginLogin(player)
|
||||
end
|
||||
|
||||
--For Opening. Set Director and reset position incase d/c
|
||||
if (player:HasQuest(110001) == true and player:GetZoneID() == 193) then
|
||||
director = player:GetZone():CreateDirector("OpeningDirector", false);
|
||||
if (player:HasQuest(110001) == true and player.CurrentArea.ZoneId == 193) then
|
||||
director = player.CurrentArea:CreateDirector("OpeningDirector", false);
|
||||
player:AddDirector(director);
|
||||
director:StartDirector(true);
|
||||
player:SetLoginDirector(director);
|
||||
@ -32,8 +32,8 @@ function onBeginLogin(player)
|
||||
player.positionZ = -36.91;
|
||||
player.rotation = 0.025;
|
||||
player:GetQuest(110001):ClearData();
|
||||
elseif (player:HasQuest(110005) == true and player:GetZoneID() == 166) then
|
||||
director = player:GetZone():CreateDirector("OpeningDirector", false);
|
||||
elseif (player:HasQuest(110005) == true and player.CurrentArea.ZoneId == 166) then
|
||||
director = player.CurrentArea:CreateDirector("OpeningDirector", false);
|
||||
player:AddDirector(director);
|
||||
director:StartDirector(false);
|
||||
player:SetLoginDirector(director);
|
||||
@ -45,8 +45,8 @@ function onBeginLogin(player)
|
||||
player.rotation = -1.26721;
|
||||
player:GetQuest(110005):ClearQuestData();
|
||||
player:GetQuest(110005):ClearQuestFlags();
|
||||
elseif (player:HasQuest(110009) == true and player:GetZoneID() == 184) then
|
||||
--director = player:GetZone():CreateDirector("OpeningDirector", false);
|
||||
elseif (player:HasQuest(110009) == true and player.CurrentArea.ZoneId == 184) then
|
||||
--director = player.CurrentArea:CreateDirector("OpeningDirector", false);
|
||||
--player:AddDirector(director);
|
||||
--director:StartDirector(false);
|
||||
--player:SetLoginDirector(director);
|
||||
|
@ -0,0 +1,6 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 5,
|
||||
shopPack = 3008,
|
||||
tutorialId = 35
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 94,
|
||||
shopPack = 0x67,
|
||||
shopCurrancy = nil
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
require ("global")
|
||||
|
||||
function onEventStarted(player, npc)
|
||||
defaultSea = GetStaticActor("DftSea");
|
||||
callClientFunction(player, "delegateEvent", player, defaultSea, "defaultTalkWithMerchant002_001", nil, nil, nil);
|
||||
player:endEvent();
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 97,
|
||||
shopPack = 3010
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 100,
|
||||
shopPack = 3013
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 99,
|
||||
shopPack = 3012
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 98,
|
||||
shopPack = 3011
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 106,
|
||||
shopPack = 3007
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
|
||||
shopInfo = {
|
||||
selectMode = 2,
|
||||
welcomeText = 281,
|
||||
shopPack = {5001, 5002, 5007, 5008},
|
||||
tutorialId = -1
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 84,
|
||||
shopPack = 3018
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
|
||||
shopInfo = {
|
||||
selectMode = 3,
|
||||
welcomeText = 281,
|
||||
shopPack = {5004, 5005, 5006, 5003},
|
||||
tutorialId = -1
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 103,
|
||||
shopPack = 3015
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 102,
|
||||
shopPack = 3016
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 104,
|
||||
shopPack = 3017
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 112,
|
||||
shopPack = 3001
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 96,
|
||||
shopPack = 3009
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 105,
|
||||
shopPack = 3004
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 108,
|
||||
shopPack = 3006
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 101,
|
||||
shopPack = 3014
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 237,
|
||||
shopPack = 3023
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 109,
|
||||
shopPack = 3005
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 69,
|
||||
shopPack = 3020,
|
||||
tutorialId = 35
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 64,
|
||||
shopPack = 3021,
|
||||
tutorialId = 34
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 76,
|
||||
shopPack = 3022,
|
||||
tutorialId = 39
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 54,
|
||||
shopPack = 3019,
|
||||
tutorialId = 32
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 265,
|
||||
shopPack = 3024
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 111,
|
||||
shopPack = 3003
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
|
||||
shopInfo = {
|
||||
welcomeText = 110,
|
||||
shopPack = 3002
|
||||
}
|
@ -62,7 +62,7 @@ namespace Meteor.Map.Actors
|
||||
public uint actorId;
|
||||
public string actorName;
|
||||
|
||||
public uint displayNameId = 0xFFFFFFFF;
|
||||
public int displayNameId = -1;
|
||||
public string customDisplayName;
|
||||
|
||||
public ushort currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE;
|
||||
@ -74,12 +74,10 @@ namespace Meteor.Map.Actors
|
||||
public ushort moveState, oldMoveState;
|
||||
public float[] moveSpeeds = new float[4];
|
||||
|
||||
public uint zoneId, zoneId2;
|
||||
public string privateArea;
|
||||
public uint privateAreaType;
|
||||
public Area zone = null;
|
||||
public Area CurrentArea { set; get; }
|
||||
public bool IsZoneing { set; get; }
|
||||
|
||||
public Area zone2 = null;
|
||||
public bool isZoning = false;
|
||||
|
||||
public bool spawnedFirstTime = false;
|
||||
|
||||
@ -463,7 +461,7 @@ namespace Meteor.Map.Actors
|
||||
positionY = pos.Y;
|
||||
positionZ = pos.Z;
|
||||
|
||||
zone.UpdateActorPosition(this);
|
||||
CurrentArea.UpdateActorPosition(this);
|
||||
|
||||
//Program.Server.GetInstance().mLuaEngine.OnPath(actor, position, positionUpdates)
|
||||
}
|
||||
@ -495,7 +493,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
updateFlags = ActorUpdateFlags.None;
|
||||
}
|
||||
zone.BroadcastPacketsAroundActor(this, packets);
|
||||
CurrentArea.BroadcastPacketsAroundActor(this, packets);
|
||||
}
|
||||
|
||||
public void GenerateActorName(int actorNumber)
|
||||
@ -511,7 +509,7 @@ namespace Meteor.Map.Actors
|
||||
className = Char.ToLowerInvariant(className[0]) + className.Substring(1);
|
||||
|
||||
//Format Zone Name
|
||||
string zoneName = zone.zoneName.Replace("Field", "Fld")
|
||||
string zoneName = CurrentArea.ZoneName.Replace("Field", "Fld")
|
||||
.Replace("Dungeon", "Dgn")
|
||||
.Replace("Town", "Twn")
|
||||
.Replace("Battle", "Btl")
|
||||
@ -519,7 +517,7 @@ namespace Meteor.Map.Actors
|
||||
.Replace("Event", "Evt")
|
||||
.Replace("Ship", "Shp")
|
||||
.Replace("Office", "Ofc");
|
||||
if (zone is PrivateArea)
|
||||
if (CurrentArea is PrivateArea)
|
||||
{
|
||||
//Check if "normal"
|
||||
zoneName = zoneName.Remove(zoneName.Length - 1, 1) + "P";
|
||||
@ -537,10 +535,8 @@ namespace Meteor.Map.Actors
|
||||
string classNumber = Utils.ToStringBase63(actorNumber);
|
||||
|
||||
//Get stuff after @
|
||||
uint zoneId = zone.actorId;
|
||||
uint privLevel = 0;
|
||||
if (zone is PrivateArea)
|
||||
privLevel = ((PrivateArea)zone).GetPrivateAreaType();
|
||||
uint zoneId = CurrentArea.ZoneId;
|
||||
int privLevel = CurrentArea.GetPrivateAreaType();
|
||||
|
||||
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
|
||||
}
|
||||
@ -629,13 +625,14 @@ namespace Meteor.Map.Actors
|
||||
#region positioning
|
||||
public List<float> GetPos()
|
||||
{
|
||||
List<float> pos = new List<float>();
|
||||
|
||||
pos.Add(positionX);
|
||||
pos.Add(positionY);
|
||||
pos.Add(positionZ);
|
||||
pos.Add(rotation);
|
||||
pos.Add(zoneId);
|
||||
List<float> pos = new List<float>
|
||||
{
|
||||
positionX,
|
||||
positionY,
|
||||
positionZ,
|
||||
rotation,
|
||||
CurrentArea.ZoneId
|
||||
};
|
||||
|
||||
return pos;
|
||||
}
|
||||
@ -658,17 +655,7 @@ namespace Meteor.Map.Actors
|
||||
rotation = rot;
|
||||
|
||||
// todo: handle zone?
|
||||
zone.BroadcastPacketAroundActor(this, MoveActorToPositionPacket.BuildPacket(actorId, x, y, z, rot, moveState));
|
||||
}
|
||||
|
||||
public Area GetZone()
|
||||
{
|
||||
return zone;
|
||||
}
|
||||
|
||||
public uint GetZoneID()
|
||||
{
|
||||
return zoneId;
|
||||
CurrentArea.BroadcastPacketAroundActor(this, MoveActorToPositionPacket.BuildPacket(actorId, x, y, z, rot, moveState));
|
||||
}
|
||||
|
||||
public void LookAt(Actor actor)
|
||||
|
@ -34,8 +34,9 @@ namespace Meteor.Map.Actors
|
||||
{
|
||||
class Area : Actor
|
||||
{
|
||||
public string zoneName;
|
||||
public ushort regionId;
|
||||
public string ZoneName { get; private set; }
|
||||
public uint ZoneId { get; private set; }
|
||||
public ushort RegionId { get; private set; }
|
||||
public bool isIsolated, canStealth, isInn, canRideChocobo, isInstanceRaid;
|
||||
public ushort weatherNormal, weatherCommon, weatherRare;
|
||||
public ushort bgmDay, bgmNight, bgmBattle;
|
||||
@ -59,12 +60,13 @@ namespace Meteor.Map.Actors
|
||||
|
||||
LuaScript areaScript;
|
||||
|
||||
public Area(uint id, string zoneName, ushort regionId, string classPath, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
|
||||
: base(id)
|
||||
public Area(uint zoneId, string zoneName, ushort regionId, string classPath, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
|
||||
: base((4 << 28 | zoneId << 19 | ((uint)1)))
|
||||
{
|
||||
ZoneName = zoneName;
|
||||
ZoneId = zoneId;
|
||||
RegionId = regionId;
|
||||
|
||||
this.zoneName = zoneName;
|
||||
this.regionId = regionId;
|
||||
this.canStealth = canStealth;
|
||||
this.isIsolated = isIsolated;
|
||||
this.isInn = isInn;
|
||||
@ -77,7 +79,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
this.displayNameId = 0;
|
||||
this.customDisplayName = "_areaMaster";
|
||||
this.actorName = String.Format("_areaMaster@{0:X5}", id << 8);
|
||||
this.actorName = String.Format("_areaMaster@{0:X5}", zoneId << 8);
|
||||
|
||||
this.classPath = classPath;
|
||||
this.className = classPath.Substring(classPath.LastIndexOf("/") + 1);
|
||||
@ -97,10 +99,20 @@ namespace Meteor.Map.Actors
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string GetPrivateAreaName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public virtual int GetPrivateAreaType()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override SubPacket CreateScriptBindPacket()
|
||||
{
|
||||
List<LuaParam> lParams;
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, "/Area/Zone/ZoneDefault", -1, (byte)1, true, false, false, false, false, false, false, false);
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, ZoneName, "/Area/Zone/ZoneDefault", -1, (byte)1, true, false, false, false, false, false, false, false);
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, actorName, "ZoneDefault", lParams);
|
||||
}
|
||||
|
||||
|
@ -30,32 +30,31 @@ namespace Meteor.Map.actors.area
|
||||
{
|
||||
class PrivateArea : Area
|
||||
{
|
||||
private Zone parentZone;
|
||||
private string privateAreaName;
|
||||
private uint privateAreaType;
|
||||
private readonly Zone ParentZone;
|
||||
private readonly string PrivateAreaName;
|
||||
private readonly int PrivateAreaType;
|
||||
|
||||
public PrivateArea(Zone parent, uint id, string classPath, string privateAreaName, uint privateAreaType, ushort bgmDay, ushort bgmNight, ushort bgmBattle)
|
||||
: base(id, parent.zoneName, parent.regionId, classPath, bgmDay, bgmNight, bgmBattle, parent.isIsolated, parent.isInn, parent.canRideChocobo, parent.canStealth, true)
|
||||
public PrivateArea(Zone parent, string classPath, string privateAreaName, int privateAreaType, ushort bgmDay, ushort bgmNight, ushort bgmBattle)
|
||||
: base(parent.ZoneId, parent.ZoneName, parent.RegionId, classPath, bgmDay, bgmNight, bgmBattle, parent.isIsolated, parent.isInn, parent.canRideChocobo, parent.canStealth, true)
|
||||
{
|
||||
this.parentZone = parent;
|
||||
this.zoneName = parent.zoneName;
|
||||
this.privateAreaName = privateAreaName;
|
||||
this.privateAreaType = privateAreaType;
|
||||
this.ParentZone = parent;
|
||||
this.PrivateAreaName = privateAreaName;
|
||||
this.PrivateAreaType = privateAreaType;
|
||||
}
|
||||
|
||||
public string GetPrivateAreaName()
|
||||
public override string GetPrivateAreaName()
|
||||
{
|
||||
return privateAreaName;
|
||||
return PrivateAreaName;
|
||||
}
|
||||
|
||||
public uint GetPrivateAreaType()
|
||||
public override int GetPrivateAreaType()
|
||||
{
|
||||
return privateAreaType;
|
||||
return PrivateAreaType;
|
||||
}
|
||||
|
||||
public Zone GetParentZone()
|
||||
{
|
||||
return parentZone;
|
||||
return ParentZone;
|
||||
}
|
||||
|
||||
public override SubPacket CreateScriptBindPacket()
|
||||
@ -66,7 +65,7 @@ namespace Meteor.Map.actors.area
|
||||
|
||||
string realClassName = className.Substring(className.LastIndexOf("/") + 1);
|
||||
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, privateAreaName, privateAreaType, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false);
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, ZoneName, PrivateAreaName, PrivateAreaType, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false);
|
||||
ActorInstantiatePacket.BuildPacket(actorId, actorName, realClassName, lParams).DebugPrintSubPacket();
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, actorName, realClassName, lParams);
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ namespace Meteor.Map.actors.area
|
||||
return null;
|
||||
}
|
||||
|
||||
public PrivateAreaContent(Zone parent, string classPath, string privateAreaName, uint privateAreaType, Director director, Player contentStarter) //TODO: Make it a list
|
||||
: base(parent, parent.actorId, classPath, privateAreaName, privateAreaType, 0, 0, 0)
|
||||
public PrivateAreaContent(Zone parent, string classPath, string privateAreaName, int privateAreaType, Director director, Player contentStarter) //TODO: Make it a list
|
||||
: base(parent, classPath, privateAreaName, privateAreaType, 0, 0, 0)
|
||||
{
|
||||
currentDirector = director;
|
||||
LuaEngine.GetInstance().CallLuaFunction(contentStarter, this, "onCreate", false, currentDirector);
|
||||
|
@ -27,7 +27,7 @@ namespace Meteor.Map.actors.area
|
||||
public string uniqueId;
|
||||
public uint zoneId;
|
||||
public string privAreaName;
|
||||
public uint privAreaLevel;
|
||||
public int privAreaLevel;
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
@ -35,7 +35,7 @@ namespace Meteor.Map.actors.area
|
||||
public ushort state;
|
||||
public uint animId;
|
||||
|
||||
public SpawnLocation(uint classId, string uniqueId, uint zoneId, string privAreaName, uint privAreaLevel, float x, float y, float z, float rot, ushort state, uint animId)
|
||||
public SpawnLocation(uint classId, string uniqueId, uint zoneId, string privAreaName, int privAreaLevel, float x, float y, float z, float rot, ushort state, uint animId)
|
||||
{
|
||||
this.classId = classId;
|
||||
this.uniqueId = uniqueId;
|
||||
|
@ -31,7 +31,7 @@ namespace Meteor.Map.actors.area
|
||||
{
|
||||
class Zone : Area
|
||||
{
|
||||
Dictionary<string, Dictionary<uint, PrivateArea>> privateAreas = new Dictionary<string, Dictionary<uint, PrivateArea>>();
|
||||
Dictionary<string, Dictionary<int, PrivateArea>> privateAreas = new Dictionary<string, Dictionary<int, PrivateArea>>();
|
||||
Dictionary<string, List<PrivateAreaContent>> contentAreas = new Dictionary<string, List<PrivateAreaContent>>();
|
||||
Object contentAreasLock = new Object();
|
||||
|
||||
@ -68,18 +68,20 @@ namespace Meteor.Map.actors.area
|
||||
privateAreas[pa.GetPrivateAreaName()][pa.GetPrivateAreaType()] = pa;
|
||||
else
|
||||
{
|
||||
privateAreas[pa.GetPrivateAreaName()] = new Dictionary<uint, PrivateArea>();
|
||||
privateAreas[pa.GetPrivateAreaName()][pa.GetPrivateAreaType()] = pa;
|
||||
privateAreas[pa.GetPrivateAreaName()] = new Dictionary<int, PrivateArea>
|
||||
{
|
||||
[pa.GetPrivateAreaType()] = pa
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public PrivateArea GetPrivateArea(string type, uint number)
|
||||
public PrivateArea GetPrivateArea(string name, int type)
|
||||
{
|
||||
if (privateAreas.ContainsKey(type))
|
||||
if (privateAreas.ContainsKey(name))
|
||||
{
|
||||
Dictionary<uint, PrivateArea> instances = privateAreas[type];
|
||||
if (instances.ContainsKey(number))
|
||||
return instances[number];
|
||||
Dictionary<int, PrivateArea> instances = privateAreas[name];
|
||||
if (instances.ContainsKey(type))
|
||||
return instances[type];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@ -92,7 +94,7 @@ namespace Meteor.Map.actors.area
|
||||
bool isEntranceDesion = false;
|
||||
|
||||
List<LuaParam> lParams;
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, "", -1, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, true, isInstanceRaid, isEntranceDesion);
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, ZoneName, "", -1, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, true, isInstanceRaid, isEntranceDesion);
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams);
|
||||
}
|
||||
|
||||
@ -103,14 +105,14 @@ namespace Meteor.Map.actors.area
|
||||
{
|
||||
if (privateAreas.ContainsKey(spawn.privAreaName))
|
||||
{
|
||||
Dictionary<uint, PrivateArea> levels = privateAreas[spawn.privAreaName];
|
||||
Dictionary<int, PrivateArea> levels = privateAreas[spawn.privAreaName];
|
||||
if (levels.ContainsKey(spawn.privAreaLevel))
|
||||
levels[spawn.privAreaLevel].AddSpawnLocation(spawn);
|
||||
else
|
||||
Program.Log.Error("Tried to add a spawn location to non-existing private area level \"{0}\" in area {1} in zone {2}", spawn.privAreaName, spawn.privAreaLevel, zoneName);
|
||||
Program.Log.Error("Tried to add a spawn location to non-existing private area level \"{0}\" in area {1} in zone {2}", spawn.privAreaName, spawn.privAreaLevel, ZoneName);
|
||||
}
|
||||
else
|
||||
Program.Log.Error("Tried to add a spawn location to non-existing private area \"{0}\" in zone {1}", spawn.privAreaName, zoneName);
|
||||
Program.Log.Error("Tried to add a spawn location to non-existing private area \"{0}\" in zone {1}", spawn.privAreaName, ZoneName);
|
||||
}
|
||||
else
|
||||
mSpawnLocations.Add(spawn);
|
||||
@ -123,7 +125,7 @@ namespace Meteor.Map.actors.area
|
||||
|
||||
if (doPrivAreas)
|
||||
{
|
||||
foreach (Dictionary<uint, PrivateArea> areas in privateAreas.Values)
|
||||
foreach (var areas in privateAreas.Values)
|
||||
{
|
||||
foreach (PrivateArea pa in areas.Values)
|
||||
pa.SpawnAllActors();
|
||||
@ -137,7 +139,7 @@ namespace Meteor.Map.actors.area
|
||||
{
|
||||
if (!mActorList.ContainsKey(id))
|
||||
{
|
||||
foreach (Dictionary<uint, PrivateArea> paList in privateAreas.Values)
|
||||
foreach (var paList in privateAreas.Values)
|
||||
{
|
||||
foreach (PrivateArea pa in paList.Values)
|
||||
{
|
||||
|
@ -335,7 +335,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.zone != user.zone)
|
||||
if (target.CurrentArea != user.CurrentArea)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -45,7 +45,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
||||
contentGroupCharas = new List<Character>(owner.currentContentGroup.GetMemberCount());
|
||||
foreach (var charaId in owner.currentContentGroup.GetMembers())
|
||||
{
|
||||
var chara = owner.zone.FindActorInArea<Character>(charaId);
|
||||
var chara = owner.CurrentArea.FindActorInArea<Character>(charaId);
|
||||
|
||||
if (chara != null)
|
||||
contentGroupCharas.Add(chara);
|
||||
|
@ -98,7 +98,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
||||
{
|
||||
if (!owner.neutral && owner.IsAlive())
|
||||
{
|
||||
foreach (var chara in owner.zone.GetActorsAroundActor<Character>(owner, 50))
|
||||
foreach (var chara in owner.CurrentArea.GetActorsAroundActor<Character>(owner, 50))
|
||||
{
|
||||
if (chara.allegiance == owner.allegiance)
|
||||
continue;
|
||||
@ -276,7 +276,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
||||
{
|
||||
if (owner.target is Player)
|
||||
{
|
||||
foreach (var chara in owner.zone.GetActorsAroundActor<Character>(owner, 1))
|
||||
foreach (var chara in owner.CurrentArea.GetActorsAroundActor<Character>(owner, 1))
|
||||
{
|
||||
if (chara == owner)
|
||||
continue;
|
||||
@ -404,7 +404,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
||||
|
||||
public virtual bool CanSeePoint(float x, float y, float z)
|
||||
{
|
||||
return NavmeshUtils.CanSee((Zone)owner.zone, owner.positionX, owner.positionY, owner.positionZ, x, y, z);
|
||||
return NavmeshUtils.CanSee((Zone)owner.CurrentArea, owner.positionX, owner.positionY, owner.positionZ, x, y, z);
|
||||
}
|
||||
|
||||
protected virtual void HandleHate()
|
||||
@ -420,7 +420,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
||||
owner.currentLockedTarget = target?.actorId ?? Actor.INVALID_ACTORID;
|
||||
owner.currentTarget = target?.actorId ?? Actor.INVALID_ACTORID;
|
||||
|
||||
foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50))
|
||||
foreach (var player in owner.CurrentArea.GetActorsAroundActor<Player>(owner, 50))
|
||||
player.QueuePacket(owner.GetHateTypePacket(player));
|
||||
|
||||
base.ChangeTarget(target);
|
||||
|
@ -55,17 +55,17 @@ namespace Meteor.Map.actors.chara.ai
|
||||
{
|
||||
PreparePath(dest.X, dest.Y, dest.Z, stepSize, maxPath, polyRadius);
|
||||
}
|
||||
|
||||
//TODO: Verify pathfind with new area setup
|
||||
public void PreparePath(float x, float y, float z, float stepSize = 1.25f, int maxPath = 40, float polyRadius = 0.0f)
|
||||
{
|
||||
var pos = new Vector3(owner.positionX, owner.positionY, owner.positionZ);
|
||||
var dest = new Vector3(x, y, z);
|
||||
|
||||
Zone zone;
|
||||
if (owner.GetZone() is PrivateArea || owner.GetZone() is PrivateAreaContent)
|
||||
zone = (Zone)((PrivateArea)owner.GetZone()).GetParentZone();
|
||||
if (owner.CurrentArea is PrivateArea || owner.CurrentArea is PrivateAreaContent)
|
||||
zone = (Zone)((PrivateArea)owner.CurrentArea).GetParentZone();
|
||||
else
|
||||
zone = (Zone)owner.GetZone();
|
||||
zone = (Zone)owner.CurrentArea;
|
||||
|
||||
var sw = new System.Diagnostics.Stopwatch();
|
||||
sw.Start();
|
||||
|
@ -285,7 +285,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
{
|
||||
foreach (var actorId in party.members)
|
||||
{
|
||||
AddTarget(owner.zone.FindActorInArea<Character>(actorId), withPet);
|
||||
AddTarget(owner.CurrentArea.FindActorInArea<Character>(actorId), withPet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -299,7 +299,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
private void AddAllBattleNpcs(Character target, bool withPet)
|
||||
{
|
||||
int dist = (int)maxDistance;
|
||||
var actors = owner.zone.GetActorsAroundActor<BattleNpc>(target, dist);
|
||||
var actors = owner.CurrentArea.GetActorsAroundActor<BattleNpc>(target, dist);
|
||||
|
||||
foreach (BattleNpc actor in actors)
|
||||
{
|
||||
@ -309,7 +309,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
|
||||
private void AddAllInZone(Character target, bool withPet)
|
||||
{
|
||||
var actors = owner.zone.GetAllActors<Character>();
|
||||
var actors = owner.CurrentArea.GetAllActors<Character>();
|
||||
foreach (Character actor in actors)
|
||||
{
|
||||
AddTarget(actor, withPet);
|
||||
@ -319,7 +319,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
private void AddAllInRange(Character target, bool withPet)
|
||||
{
|
||||
int dist = (int)maxDistance;
|
||||
var actors = owner.zone.GetActorsAroundActor<Character>(target, dist);
|
||||
var actors = owner.CurrentArea.GetActorsAroundActor<Character>(target, dist);
|
||||
|
||||
foreach (Character actor in actors)
|
||||
{
|
||||
@ -408,7 +408,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/*target.isZoning || owner.isZoning || */target.zone != owner.zone)
|
||||
if (/*target.isZoning || owner.isZoning || */target.CurrentArea != owner.CurrentArea)
|
||||
return false;
|
||||
|
||||
if (validTarget == ValidTarget.Self && aoeType == TargetFindAOEType.None && owner != target)
|
||||
|
@ -50,7 +50,7 @@ namespace Meteor.Map.actors.chara.ai.state
|
||||
public override bool Update(DateTime tick)
|
||||
{
|
||||
if ((target == null || owner.target != target || owner.target?.actorId != owner.currentLockedTarget) && owner.isAutoAttackEnabled)
|
||||
owner.aiContainer.ChangeTarget(target = owner.zone.FindActorInArea<Character>(owner.currentTarget));
|
||||
owner.aiContainer.ChangeTarget(target = owner.CurrentArea.FindActorInArea<Character>(owner.currentTarget));
|
||||
|
||||
if (target == null || target.IsDead())
|
||||
{
|
||||
@ -91,7 +91,7 @@ namespace Meteor.Map.actors.chara.ai.state
|
||||
// todo: send paralyzed/sleep message etc.
|
||||
if (errorResult != null)
|
||||
{
|
||||
owner.zone.BroadcastPacketAroundActor(owner, CommandResultX01Packet.BuildPacket(errorResult.targetId, errorResult.animation, 0x765D, errorResult));
|
||||
owner.CurrentArea.BroadcastPacketAroundActor(owner, CommandResultX01Packet.BuildPacket(errorResult.targetId, errorResult.animation, 0x765D, errorResult));
|
||||
errorResult = null;
|
||||
}
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("charaWork/currentContentGroup", this);
|
||||
propPacketUtil.AddProperty("charaWork.currentContentGroup");
|
||||
zone.BroadcastPacketsAroundActor(this, propPacketUtil.Done());
|
||||
CurrentArea.BroadcastPacketsAroundActor(this, propPacketUtil.Done());
|
||||
}
|
||||
|
||||
//This logic isn't correct, order of GetStatusEffects() is not necessarily the same as the actual effects in game. Also sending every time at once isn't needed
|
||||
@ -243,17 +243,17 @@ namespace Meteor.Map.Actors
|
||||
((Player)this).QueuePacket(PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
|
||||
}
|
||||
else
|
||||
zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
|
||||
}
|
||||
|
||||
public void DoBattleAction(ushort commandId, uint animationId)
|
||||
{
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX00Packet.BuildPacket(actorId, animationId, commandId));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX00Packet.BuildPacket(actorId, animationId, commandId));
|
||||
}
|
||||
|
||||
public void DoBattleAction(ushort commandId, uint animationId, CommandResult result)
|
||||
{
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, result));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, result));
|
||||
}
|
||||
|
||||
public void DoBattleAction(ushort commandId, uint animationId, CommandResult[] results)
|
||||
@ -263,12 +263,12 @@ namespace Meteor.Map.Actors
|
||||
while (true)
|
||||
{
|
||||
if (results.Length - currentIndex >= 10)
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
else if (results.Length - currentIndex > 1)
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
else if (results.Length - currentIndex == 1)
|
||||
{
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, results[currentIndex]));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, results[currentIndex]));
|
||||
currentIndex++;
|
||||
}
|
||||
else
|
||||
@ -283,12 +283,12 @@ namespace Meteor.Map.Actors
|
||||
while (true)
|
||||
{
|
||||
if (results.Count - currentIndex >= 10)
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
else if (results.Count - currentIndex > 1)
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
else if (results.Count - currentIndex == 1)
|
||||
{
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, results[currentIndex]));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, results[currentIndex]));
|
||||
currentIndex++;
|
||||
}
|
||||
else
|
||||
@ -504,7 +504,7 @@ namespace Meteor.Map.Actors
|
||||
}
|
||||
//if (targid != 0)
|
||||
{
|
||||
aiContainer.Engage(zone.FindActorInArea<Character>(targid));
|
||||
aiContainer.Engage(CurrentArea.FindActorInArea<Character>(targid));
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,19 +535,19 @@ namespace Meteor.Map.Actors
|
||||
public virtual void Cast(uint spellId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.Cast(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), spellId);
|
||||
aiContainer.Cast(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), spellId);
|
||||
}
|
||||
|
||||
public virtual void Ability(uint abilityId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.Ability(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), abilityId);
|
||||
aiContainer.Ability(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), abilityId);
|
||||
}
|
||||
|
||||
public virtual void WeaponSkill(uint skillId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.WeaponSkill(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), skillId);
|
||||
aiContainer.WeaponSkill(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), skillId);
|
||||
}
|
||||
|
||||
public virtual void Spawn(DateTime tick)
|
||||
@ -806,7 +806,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
foreach (CommandResult action in actions)
|
||||
{
|
||||
if (zone.FindActorInArea<Character>(action.targetId) is Character)
|
||||
if (CurrentArea.FindActorInArea<Character>(action.targetId) is Character)
|
||||
{
|
||||
//BattleUtils.HandleHitType(this, chara, action);
|
||||
//BattleUtils.DoAction(this, chara, action, DamageTakenType.Magic);
|
||||
@ -822,7 +822,7 @@ namespace Meteor.Map.Actors
|
||||
foreach (CommandResult action in actions)
|
||||
{
|
||||
//Should we just store the character insteado f having to find it again?
|
||||
if (zone.FindActorInArea<Character>(action.targetId) is Character)
|
||||
if (CurrentArea.FindActorInArea<Character>(action.targetId) is Character)
|
||||
{
|
||||
//BattleUtils.DoAction(this, chara, action, DamageTakenType.Weaponskill);
|
||||
}
|
||||
@ -835,7 +835,7 @@ namespace Meteor.Map.Actors
|
||||
{
|
||||
foreach (var action in actions)
|
||||
{
|
||||
if (zone.FindActorInArea<Character>(action.targetId) is Character)
|
||||
if (CurrentArea.FindActorInArea<Character>(action.targetId) is Character)
|
||||
{
|
||||
//BattleUtils.DoAction(this, chara, action, DamageTakenType.Ability);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace Meteor.Map.actors.chara.npc
|
||||
{
|
||||
public readonly uint actorClassId;
|
||||
public readonly string classPath;
|
||||
public readonly uint displayNameId;
|
||||
public readonly int displayNameId;
|
||||
public readonly uint propertyFlags;
|
||||
public readonly string eventConditions;
|
||||
|
||||
@ -33,7 +33,7 @@ namespace Meteor.Map.actors.chara.npc
|
||||
public readonly ushort pushCommandSub;
|
||||
public readonly byte pushCommandPriority;
|
||||
|
||||
public ActorClass(uint id, string classPath, uint nameId, uint propertyFlags, string eventConditions, ushort pushCommand, ushort pushCommandSub, byte pushCommandPriority)
|
||||
public ActorClass(uint id, string classPath, int nameId, uint propertyFlags, string eventConditions, ushort pushCommand, ushort pushCommandSub, byte pushCommandPriority)
|
||||
{
|
||||
this.actorClassId = id;
|
||||
this.classPath = classPath;
|
||||
|
@ -263,8 +263,8 @@ namespace Meteor.Map.Actors
|
||||
|
||||
this.isMovingToSpawn = false;
|
||||
this.hateContainer.ClearHate();
|
||||
zone.BroadcastPacketsAroundActor(this, GetSpawnPackets(null, 0x01));
|
||||
zone.BroadcastPacketsAroundActor(this, GetInitPackets());
|
||||
CurrentArea.BroadcastPacketsAroundActor(this, GetSpawnPackets(null, 0x01));
|
||||
CurrentArea.BroadcastPacketsAroundActor(this, GetInitPackets());
|
||||
RecalculateStats();
|
||||
|
||||
OnSpawn();
|
||||
@ -292,7 +292,7 @@ namespace Meteor.Map.Actors
|
||||
{
|
||||
foreach (var memberId in ((Party)lastAttacker.currentParty).members)
|
||||
{
|
||||
var partyMember = zone.FindActorInArea<Character>(memberId);
|
||||
var partyMember = CurrentArea.FindActorInArea<Character>(memberId);
|
||||
// onDeath(monster, player, killer)
|
||||
lua.LuaEngine.CallLuaBattleFunction(this, "onDeath", this, partyMember, lastAttacker);
|
||||
|
||||
@ -320,7 +320,7 @@ namespace Meteor.Map.Actors
|
||||
}
|
||||
else
|
||||
{
|
||||
var err = String.Format("[{0}][{1}] {2} {3} {4} {5} tried to die ded", actorId, GetUniqueId(), positionX, positionY, positionZ, GetZone().GetName());
|
||||
var err = String.Format("[{0}][{1}] {2} {3} {4} {5} tried to die ded", actorId, GetUniqueId(), positionX, positionY, positionZ, CurrentArea.GetName());
|
||||
Program.Log.Error(err);
|
||||
//throw new Exception(err);
|
||||
}
|
||||
@ -385,7 +385,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
if (GetMobMod((uint)MobModifier.SpellScript) != 0)
|
||||
foreach (var action in actions)
|
||||
lua.LuaEngine.CallLuaBattleFunction(this, "onCast", this, zone.FindActorInArea<Character>(action.targetId), ((MagicState)state).GetSpell(), action);
|
||||
lua.LuaEngine.CallLuaBattleFunction(this, "onCast", this, CurrentArea.FindActorInArea<Character>(action.targetId), ((MagicState)state).GetSpell(), action);
|
||||
}
|
||||
|
||||
public override void OnAbility(State state, CommandResult[] actions, BattleCommand ability, ref CommandResult[] errors)
|
||||
@ -405,7 +405,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
if (GetMobMod((uint)MobModifier.WeaponSkillScript) != 0)
|
||||
foreach (var action in actions)
|
||||
lua.LuaEngine.CallLuaBattleFunction(this, "onWeaponSkill", this, zone.FindActorInArea<Character>(action.targetId), ((WeaponSkillState)state).GetWeaponSkill(), action);
|
||||
lua.LuaEngine.CallLuaBattleFunction(this, "onWeaponSkill", this, CurrentArea.FindActorInArea<Character>(action.targetId), ((WeaponSkillState)state).GetWeaponSkill(), action);
|
||||
}
|
||||
|
||||
public override void OnSpawn()
|
||||
|
@ -58,7 +58,7 @@ namespace Meteor.Map.Actors
|
||||
public NpcSpawnType npcSpawnType;
|
||||
|
||||
public Npc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, string customDisplayName)
|
||||
: base((4 << 28 | spawnedArea.actorId << 19 | (uint)actorNumber))
|
||||
: base((4 << 28 | spawnedArea.actorId << 19 | ((uint)actorNumber + 5)))
|
||||
{
|
||||
this.positionX = posX;
|
||||
this.positionY = posY;
|
||||
@ -72,8 +72,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
this.uniqueIdentifier = uniqueId;
|
||||
|
||||
this.zoneId = spawnedArea.actorId;
|
||||
this.zone = spawnedArea;
|
||||
CurrentArea = spawnedArea;
|
||||
|
||||
this.actorClassId = actorClass.actorClassId;
|
||||
|
||||
@ -133,8 +132,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
this.uniqueIdentifier = uniqueId;
|
||||
|
||||
this.zoneId = spawnedArea.actorId;
|
||||
this.zone = spawnedArea;
|
||||
CurrentArea = spawnedArea;
|
||||
|
||||
this.actorClassId = actorClass.actorClassId;
|
||||
|
||||
@ -298,7 +296,7 @@ namespace Meteor.Map.Actors
|
||||
public void ChangeNpcAppearance(uint id)
|
||||
{
|
||||
LoadNpcAppearance(id);
|
||||
zone.BroadcastPacketAroundActor(this, CreateAppearancePacket());
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CreateAppearancePacket());
|
||||
}
|
||||
|
||||
public void LoadNpcAppearance(uint id)
|
||||
@ -431,7 +429,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
public void Despawn()
|
||||
{
|
||||
zone.DespawnActor(this);
|
||||
CurrentArea.DespawnActor(this);
|
||||
}
|
||||
|
||||
public override void Update(DateTime tick)
|
||||
@ -463,7 +461,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
public override void OnDespawn()
|
||||
{
|
||||
zone.BroadcastPacketAroundActor(this, RemoveActorPacket.BuildPacket(this.actorId));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, RemoveActorPacket.BuildPacket(this.actorId));
|
||||
QueuePositionUpdate(spawnX, spawnY, spawnZ);
|
||||
LuaEngine.CallLuaBattleFunction(this, "onDespawn", this);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ namespace Meteor.Map.actors.chara.npc
|
||||
private Player ownerPlayer;
|
||||
|
||||
public Retainer(uint retainerId, ActorClass actorClass, Player player, float posX, float posY, float posZ, float rot)
|
||||
: base(0, actorClass, "myretainer", player.GetZone(), posX, posY, posZ, rot, 0, 0, null)
|
||||
: base(0, actorClass, "myretainer", player.CurrentArea, posX, posY, posZ, rot, 0, 0, null)
|
||||
{
|
||||
this.retainerId = retainerId;
|
||||
this.ownerPlayer = player;
|
||||
|
@ -397,7 +397,7 @@ namespace Meteor.Map.Actors
|
||||
subpackets.Add(SetCurrentMountGoobbuePacket.BuildPacket(actorId, 1));
|
||||
|
||||
//Inn Packets (Dream, Cutscenes, Armoire)
|
||||
if (zone.isInn)
|
||||
if (CurrentArea.isInn)
|
||||
{
|
||||
SetCutsceneBookPacket cutsceneBookPacket = new SetCutsceneBookPacket();
|
||||
for (int i = 0; i < 2048; i++)
|
||||
@ -578,7 +578,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
public void SendSeamlessZoneInPackets()
|
||||
{
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.bgmDay, SetMusicPacket.EFFECT_FADEIN));
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, CurrentArea.bgmDay, SetMusicPacket.EFFECT_FADEIN));
|
||||
QueuePacket(SetWeatherPacket.BuildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1));
|
||||
}
|
||||
|
||||
@ -601,11 +601,11 @@ namespace Meteor.Map.Actors
|
||||
}
|
||||
}
|
||||
else
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.bgmDay, 0x01)); //Zone
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, CurrentArea.bgmDay, 0x01)); //Zone
|
||||
|
||||
QueuePacket(SetWeatherPacket.BuildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1));
|
||||
|
||||
QueuePacket(SetMapPacket.BuildPacket(actorId, zone.regionId, zone.actorId));
|
||||
QueuePacket(SetMapPacket.BuildPacket(actorId, CurrentArea.RegionId, CurrentArea.ZoneId));
|
||||
|
||||
QueuePackets(GetSpawnPackets(this, spawnType));
|
||||
|
||||
@ -623,7 +623,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
playerSession.QueuePacket(GetInitPackets());
|
||||
|
||||
List<SubPacket> areaMasterSpawn = zone.GetSpawnPackets();
|
||||
List<SubPacket> areaMasterSpawn = CurrentArea.GetSpawnPackets();
|
||||
List<SubPacket> debugSpawn = world.GetDebugActor().GetSpawnPackets();
|
||||
List<SubPacket> worldMasterSpawn = world.GetActor().GetSpawnPackets();
|
||||
|
||||
@ -631,9 +631,9 @@ namespace Meteor.Map.Actors
|
||||
playerSession.QueuePacket(debugSpawn);
|
||||
playerSession.QueuePacket(worldMasterSpawn);
|
||||
|
||||
if (zone.GetWeatherDirector() != null)
|
||||
if (CurrentArea.GetWeatherDirector() != null)
|
||||
{
|
||||
playerSession.QueuePacket(zone.GetWeatherDirector().GetSpawnPackets());
|
||||
playerSession.QueuePacket(CurrentArea.GetWeatherDirector().GetSpawnPackets());
|
||||
}
|
||||
|
||||
foreach (Director director in ownedDirectors)
|
||||
@ -758,7 +758,7 @@ namespace Meteor.Map.Actors
|
||||
|
||||
public void ChangeAnimation(uint animId)
|
||||
{
|
||||
Actor a = zone.FindActorInArea(currentTarget);
|
||||
Actor a = CurrentArea.FindActorInArea(currentTarget);
|
||||
if (a is Npc)
|
||||
((Npc)a).animationId = animId;
|
||||
}
|
||||
@ -783,7 +783,7 @@ namespace Meteor.Map.Actors
|
||||
playerSession.LockUpdates(true);
|
||||
|
||||
//Remove actor from zone and main server list
|
||||
zone.RemoveActorFromZone(this);
|
||||
CurrentArea.RemoveActorFromZone(this);
|
||||
|
||||
//Set Destination to 0
|
||||
this.destinationZone = 0;
|
||||
@ -810,7 +810,7 @@ namespace Meteor.Map.Actors
|
||||
playerSession.LockUpdates(true);
|
||||
|
||||
//Remove actor from zone and main server list
|
||||
zone.RemoveActorFromZone(this);
|
||||
CurrentArea.RemoveActorFromZone(this);
|
||||
|
||||
//Clean up parties
|
||||
RemoveFromCurrentPartyAndCleanup();
|
||||
@ -831,11 +831,6 @@ namespace Meteor.Map.Actors
|
||||
Database.SavePlayerStatusEffects(this);
|
||||
}
|
||||
|
||||
public Area GetZone()
|
||||
{
|
||||
return zone;
|
||||
}
|
||||
|
||||
public void SendMessage(uint logType, string sender, string message)
|
||||
{
|
||||
QueuePacket(SendMessagePacket.BuildPacket(actorId, logType, sender, message));
|
||||
@ -844,7 +839,7 @@ namespace Meteor.Map.Actors
|
||||
//Only use at logout since it's intensive
|
||||
private byte GetInnCode()
|
||||
{
|
||||
if (zone.isInn)
|
||||
if (CurrentArea.isInn)
|
||||
{
|
||||
Vector3 position = new Vector3(positionX, 0, positionZ);
|
||||
if (Utils.Distance(position, new Vector3(0, 0, 0)) <= 20f)
|
||||
@ -989,7 +984,7 @@ namespace Meteor.Map.Actors
|
||||
public void BroadcastWorldMessage(ushort worldMasterId, params object[] msgParams)
|
||||
{
|
||||
//SubPacket worldMasterMessage =
|
||||
//zone.BroadcastPacketAroundActor(this, worldMasterMessage);
|
||||
//CurrentArea.BroadcastPacketAroundActor(this, worldMasterMessage);
|
||||
}
|
||||
|
||||
public void GraphicChange(uint slot, uint graphicId)
|
||||
@ -1677,7 +1672,7 @@ namespace Meteor.Map.Actors
|
||||
{
|
||||
Quest defaultTalk = null;
|
||||
|
||||
switch (npc.zone.regionId)
|
||||
switch (npc.CurrentArea.RegionId)
|
||||
{
|
||||
case 101:
|
||||
defaultTalk = (Quest) Server.GetStaticActors("DftSea");
|
||||
@ -1971,8 +1966,8 @@ namespace Meteor.Map.Actors
|
||||
//Update Instance
|
||||
List<Actor> aroundMe = new List<Actor>();
|
||||
|
||||
if (zone != null)
|
||||
aroundMe.AddRange(zone.GetActorsAroundActor(this, 50));
|
||||
if (CurrentArea != null)
|
||||
aroundMe.AddRange(CurrentArea.GetActorsAroundActor(this, 50));
|
||||
if (zone2 != null)
|
||||
aroundMe.AddRange(zone2.GetActorsAroundActor(this, 50));
|
||||
playerSession.UpdateInstance(aroundMe, force);
|
||||
@ -2137,7 +2132,7 @@ namespace Meteor.Map.Actors
|
||||
{
|
||||
rentalExpireTime = 0;
|
||||
rentalMinLeft = 0;
|
||||
ChangeMusic(GetZone().bgmDay);
|
||||
ChangeMusic(CurrentArea.bgmDay);
|
||||
SetMountState(0);
|
||||
ChangeSpeed(0.0f, 2.0f, 5.0f, 5.0f);
|
||||
ChangeState(0);
|
||||
@ -2400,7 +2395,7 @@ namespace Meteor.Map.Actors
|
||||
public override void Cast(uint spellId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.Cast(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), spellId);
|
||||
aiContainer.Cast(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), spellId);
|
||||
else if (aiContainer.IsCurrentState<MagicState>())
|
||||
// You are already casting.
|
||||
SendGameMessage(Server.GetWorldManager().GetActor(), 32536, 0x20);
|
||||
@ -2412,7 +2407,7 @@ namespace Meteor.Map.Actors
|
||||
public override void Ability(uint abilityId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.Ability(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), abilityId);
|
||||
aiContainer.Ability(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), abilityId);
|
||||
else
|
||||
// Please wait a moment and try again.
|
||||
SendGameMessage(Server.GetWorldManager().GetActor(), 32535, 0x20);
|
||||
@ -2421,7 +2416,7 @@ namespace Meteor.Map.Actors
|
||||
public override void WeaponSkill(uint skillId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.WeaponSkill(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), skillId);
|
||||
aiContainer.WeaponSkill(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), skillId);
|
||||
else
|
||||
// Please wait a moment and try again.
|
||||
SendGameMessage(Server.GetWorldManager().GetActor(), 32535, 0x20);
|
||||
|
@ -46,11 +46,10 @@ namespace Meteor.Map.actors.director
|
||||
private Coroutine currentCoroutine;
|
||||
|
||||
public Director(uint id, Area zone, string directorPath, bool hasContentGroup, params object[] args)
|
||||
: base((6 << 28 | zone.actorId << 19 | (uint)id))
|
||||
: base((6 << 28 | zone.CurrentArea.ZoneId << 19 | (uint)id))
|
||||
{
|
||||
directorId = id;
|
||||
this.zone = zone;
|
||||
this.zoneId = zone.actorId;
|
||||
CurrentArea = zone;
|
||||
directorScriptPath = directorPath;
|
||||
|
||||
LoadLuaScript();
|
||||
@ -172,7 +171,7 @@ namespace Meteor.Map.actors.director
|
||||
((Player)player).RemoveDirector(this);
|
||||
members.Clear();
|
||||
isDeleted = true;
|
||||
Server.GetWorldManager().GetZone(zoneId).DeleteDirector(actorId);
|
||||
Server.GetWorldManager().GetArea(CurrentArea.ZoneId).DeleteDirector(actorId);
|
||||
}
|
||||
|
||||
public void AddMember(Actor actor)
|
||||
@ -242,7 +241,7 @@ namespace Meteor.Map.actors.director
|
||||
className = Char.ToLowerInvariant(className[0]) + className.Substring(1);
|
||||
|
||||
//Format Zone Name
|
||||
string zoneName = zone.zoneName.Replace("Field", "Fld")
|
||||
string zoneName = CurrentArea.ZoneName.Replace("Field", "Fld")
|
||||
.Replace("Dungeon", "Dgn")
|
||||
.Replace("Town", "Twn")
|
||||
.Replace("Battle", "Btl")
|
||||
@ -250,7 +249,7 @@ namespace Meteor.Map.actors.director
|
||||
.Replace("Event", "Evt")
|
||||
.Replace("Ship", "Shp")
|
||||
.Replace("Office", "Ofc");
|
||||
if (zone is PrivateArea)
|
||||
if (CurrentArea is PrivateArea)
|
||||
{
|
||||
//Check if "normal"
|
||||
zoneName = zoneName.Remove(zoneName.Length - 1, 1) + "P";
|
||||
@ -268,10 +267,8 @@ namespace Meteor.Map.actors.director
|
||||
string classNumber = Utils.ToStringBase63(actorNumber);
|
||||
|
||||
//Get stuff after @
|
||||
uint zoneId = zone.actorId;
|
||||
uint privLevel = 0;
|
||||
if (zone is PrivateArea)
|
||||
privLevel = ((PrivateArea)zone).GetPrivateAreaType();
|
||||
uint zoneId = CurrentArea.ZoneId;
|
||||
int privLevel = CurrentArea.GetPrivateAreaType();
|
||||
|
||||
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ namespace Meteor.Map.actors.director
|
||||
|
||||
if (wasCompleted)
|
||||
{
|
||||
Npc aetheryteNode = zone.SpawnActor(1200040, String.Format("{0}:warpExit", guildleveOwner.actorName), guildleveOwner.positionX, guildleveOwner.positionY, guildleveOwner.positionZ);
|
||||
Npc aetheryteNode = CurrentArea.SpawnActor(1200040, String.Format("{0}:warpExit", guildleveOwner.actorName), guildleveOwner.positionX, guildleveOwner.positionY, guildleveOwner.positionZ);
|
||||
AddMember(aetheryteNode);
|
||||
|
||||
foreach (Actor a in GetPlayerMembers())
|
||||
@ -168,7 +168,7 @@ namespace Meteor.Map.actors.director
|
||||
foreach (Actor p in GetPlayerMembers())
|
||||
{
|
||||
Player player = (Player)p;
|
||||
player.ChangeMusic(player.GetZone().bgmDay);
|
||||
player.ChangeMusic(player.CurrentArea.bgmDay);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,26 +119,26 @@ namespace Meteor.Map.actors.group
|
||||
ulong time = Utils.MilisUnixTimeStampUTC();
|
||||
List<GroupMember> members = BuildMemberList(session.id);
|
||||
|
||||
session.QueuePacket(GroupHeaderPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupMembersBeginPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupHeaderPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
session.QueuePacket(GroupMembersBeginPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
|
||||
int currentIndex = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (GetMemberCount() - currentIndex >= 64)
|
||||
session.QueuePacket(ContentMembersX64Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(ContentMembersX64Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (GetMemberCount() - currentIndex >= 32)
|
||||
session.QueuePacket(ContentMembersX32Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(ContentMembersX32Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (GetMemberCount() - currentIndex >= 16)
|
||||
session.QueuePacket(ContentMembersX16Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(ContentMembersX16Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (GetMemberCount() - currentIndex > 0)
|
||||
session.QueuePacket(ContentMembersX08Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(ContentMembersX08Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
@ -160,7 +160,7 @@ namespace Meteor.Map.actors.group
|
||||
Session s = Server.GetServer().GetSession(members[i]);
|
||||
if (s != null)
|
||||
s.GetActor().SetCurrentContentGroup(null);
|
||||
Actor a = director.GetZone().FindActorInArea(members[i]);
|
||||
Actor a = director.CurrentArea.FindActorInArea(members[i]);
|
||||
if (a is Npc)
|
||||
((Npc)a).Despawn();
|
||||
members.Remove(members[i]);
|
||||
|
@ -141,8 +141,8 @@ namespace Meteor.Map.actors.group
|
||||
ulong time = Utils.MilisUnixTimeStampUTC();
|
||||
List<GroupMember> members = BuildMemberList(session.id);
|
||||
|
||||
session.QueuePacket(GroupHeaderPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupMembersBeginPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupHeaderPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
session.QueuePacket(GroupMembersBeginPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
|
||||
int currentIndex = 0;
|
||||
|
||||
@ -150,18 +150,18 @@ namespace Meteor.Map.actors.group
|
||||
{
|
||||
int memberCount = Math.Min(GetMemberCount(), members.Count);
|
||||
if (memberCount - currentIndex >= 64)
|
||||
session.QueuePacket(GroupMembersX64Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(GroupMembersX64Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (memberCount - currentIndex >= 32)
|
||||
session.QueuePacket(GroupMembersX32Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(GroupMembersX32Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (memberCount - currentIndex >= 16)
|
||||
session.QueuePacket(GroupMembersX16Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(GroupMembersX16Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (memberCount - currentIndex > 0)
|
||||
session.QueuePacket(GroupMembersX08Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(GroupMembersX08Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
|
||||
}
|
||||
|
||||
|
@ -388,9 +388,9 @@ namespace Meteor.Map
|
||||
cmd.Parameters.AddWithValue("@y", player.positionY);
|
||||
cmd.Parameters.AddWithValue("@z", player.positionZ);
|
||||
cmd.Parameters.AddWithValue("@rot", player.rotation);
|
||||
cmd.Parameters.AddWithValue("@zoneId", player.zoneId);
|
||||
cmd.Parameters.AddWithValue("@privateArea", player.privateArea);
|
||||
cmd.Parameters.AddWithValue("@privateAreaType", player.privateAreaType);
|
||||
cmd.Parameters.AddWithValue("@zoneId", player.CurrentArea.ZoneId);
|
||||
cmd.Parameters.AddWithValue("@privateArea", player.CurrentArea.GetPrivateAreaName());
|
||||
cmd.Parameters.AddWithValue("@privateAreaType", player.CurrentArea.GetPrivateAreaType());
|
||||
cmd.Parameters.AddWithValue("@destZone", player.destinationZone);
|
||||
cmd.Parameters.AddWithValue("@destSpawn", player.destinationSpawnType);
|
||||
|
||||
@ -783,15 +783,19 @@ namespace Meteor.Map
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
player.displayNameId = 0xFFFFFFFF;
|
||||
uint zoneId;
|
||||
string privateAreaName = null;
|
||||
int privateAreaType;
|
||||
|
||||
|
||||
player.displayNameId = -1;
|
||||
player.customDisplayName = reader.GetString(0);
|
||||
player.oldPositionX = player.positionX = reader.GetFloat(1);
|
||||
player.oldPositionY = player.positionY = reader.GetFloat(2);
|
||||
player.oldPositionZ = player.positionZ = reader.GetFloat(3);
|
||||
player.oldRotation = player.rotation = reader.GetFloat(4);
|
||||
player.currentMainState = reader.GetUInt16(5);
|
||||
player.zoneId = reader.GetUInt32(6);
|
||||
player.isZoning = true;
|
||||
player.IsZoneing = true;
|
||||
player.gcCurrent = reader.GetByte(7);
|
||||
player.gcRankLimsa = reader.GetByte(8);
|
||||
player.gcRankGridania = reader.GetByte(9);
|
||||
@ -810,17 +814,14 @@ namespace Meteor.Map
|
||||
player.destinationZone = reader.GetUInt32("destinationZoneId");
|
||||
player.destinationSpawnType = reader.GetByte("destinationSpawnType");
|
||||
|
||||
if (!reader.IsDBNull(reader.GetOrdinal("currentPrivateArea")))
|
||||
player.privateArea = reader.GetString("currentPrivateArea");
|
||||
player.privateAreaType = reader.GetUInt32("currentPrivateAreaType");
|
||||
|
||||
// Get the area the player is in
|
||||
zoneId = reader.GetUInt32(6);
|
||||
if (player.destinationZone != 0)
|
||||
player.zoneId = player.destinationZone;
|
||||
|
||||
if (player.privateArea != null && !player.privateArea.Equals(""))
|
||||
player.zone = Server.GetWorldManager().GetPrivateArea(player.zoneId, player.privateArea, player.privateAreaType);
|
||||
else
|
||||
player.zone = Server.GetWorldManager().GetZone(player.zoneId);
|
||||
zoneId = player.destinationZone;
|
||||
if (!reader.IsDBNull(reader.GetOrdinal("currentPrivateArea")))
|
||||
privateAreaName = reader.GetString("currentPrivateArea");
|
||||
privateAreaType = reader.GetInt32("currentPrivateAreaType");
|
||||
player.CurrentArea = Server.GetWorldManager().GetArea(zoneId, privateAreaName, privateAreaType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ using System.Threading;
|
||||
using Meteor.Map.actors.chara.ai;
|
||||
using Meteor.Map.actors.chara.ai.controllers;
|
||||
using Meteor.Map.DataObjects;
|
||||
using Meteor.Map.actors.chara.player;
|
||||
|
||||
namespace Meteor.Map.lua
|
||||
{
|
||||
@ -64,17 +65,23 @@ namespace Meteor.Map.lua
|
||||
luaTimer = new Timer(new TimerCallback(PulseSleepingOnTime),
|
||||
null, TimeSpan.Zero, TimeSpan.FromMilliseconds(50));
|
||||
|
||||
UserData.RegistrationPolicy = InteropRegistrationPolicy.Automatic;
|
||||
|
||||
/*
|
||||
UserData.RegisterType<LuaEngine>();
|
||||
UserData.RegisterType<Player>();
|
||||
UserData.RegisterType<Command>();
|
||||
UserData.RegisterType<Npc>();
|
||||
UserData.RegisterType<Quest>();
|
||||
UserData.RegisterType<Zone>();
|
||||
UserData.RegisterType<InventoryItem>();
|
||||
UserData.RegisterType<ItemPackage>();
|
||||
UserData.RegisterType<PrivateArea>();
|
||||
UserData.RegisterType<PrivateAreaContent>();
|
||||
UserData.RegisterType<Director>();
|
||||
UserData.RegisterType<WorldManager>();
|
||||
UserData.RegisterType<WorldMaster>();
|
||||
*/
|
||||
}
|
||||
|
||||
public static LuaEngine GetInstance()
|
||||
@ -180,7 +187,7 @@ namespace Meteor.Map.lua
|
||||
{
|
||||
// todo: this is probably unnecessary as im not sure there were pets for players
|
||||
if (!(actor.aiContainer.GetController<PetController>()?.GetPetMaster() is Player))
|
||||
path = String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/{1}/{2}.lua", actor.zone.zoneName, actor is BattleNpc ? "Monster" : "PopulaceStandard", ((Npc)actor).GetUniqueId());
|
||||
path = String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/{1}/{2}.lua", actor.CurrentArea.ZoneName, actor is BattleNpc ? "Monster" : "PopulaceStandard", ((Npc)actor).GetUniqueId());
|
||||
}
|
||||
// dont wanna throw an error if file doesnt exist
|
||||
if (File.Exists(path))
|
||||
@ -389,7 +396,7 @@ namespace Meteor.Map.lua
|
||||
}
|
||||
else if (target is Area)
|
||||
{
|
||||
return root + String.Format(FILEPATH_ZONE, ((Area)target).zoneName);
|
||||
return root + String.Format(FILEPATH_ZONE, ((Area)target).ZoneName);
|
||||
}
|
||||
else if (target is Quest)
|
||||
{
|
||||
@ -422,21 +429,23 @@ namespace Meteor.Map.lua
|
||||
if (!errorMsg.Equals(""))
|
||||
SendError(player, errorMsg);
|
||||
|
||||
Area area = target.zone;
|
||||
Area area = target.CurrentArea;
|
||||
if (area is PrivateArea)
|
||||
{
|
||||
if (File.Exists(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()), ref errorMsg);
|
||||
string path = $"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{area.ZoneName}/privatearea/{((PrivateArea)area).GetPrivateAreaName()}_{((PrivateArea)area).GetPrivateAreaType()}/{target.className}/{target.GetUniqueId()}.lua";
|
||||
if (File.Exists(path))
|
||||
child = LuaEngine.LoadScript(path, ref errorMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()), ref errorMsg);
|
||||
string path = $"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{area.ZoneName}/{target.className}/{target.GetUniqueId()}.lua";
|
||||
if (File.Exists(path))
|
||||
child = LuaEngine.LoadScript(path, ref errorMsg);
|
||||
}
|
||||
|
||||
if (parent == null && child == null)
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
||||
LuaEngine.SendError(player, $"ERROR: Could not find script for actor {target.GetName()}.");
|
||||
}
|
||||
|
||||
//Run Script
|
||||
@ -471,16 +480,16 @@ namespace Meteor.Map.lua
|
||||
if (File.Exists($"{ConfigConstants.OPTIONS_SCRIPTPATH}/base/" + target.classPath + ".lua"))
|
||||
parent = LuaEngine.LoadScript($"{ConfigConstants.OPTIONS_SCRIPTPATH}/base/" + target.classPath + ".lua", ref errorMsg);
|
||||
|
||||
Area area = target.zone;
|
||||
Area area = target.CurrentArea;
|
||||
if (area is PrivateArea)
|
||||
{
|
||||
if (File.Exists(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()), ref errorMsg);
|
||||
if (File.Exists(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.ZoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.ZoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()), ref errorMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()), ref errorMsg);
|
||||
if (File.Exists(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/{1}/{2}.lua", area.ZoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/{1}/{2}.lua", area.ZoneName, target.className, target.GetUniqueId()), ref errorMsg);
|
||||
}
|
||||
|
||||
if (parent == null && child == null)
|
||||
|
@ -206,7 +206,7 @@ namespace Meteor.Map
|
||||
ownerActor = session.GetActor().currentSpawnedRetainer;
|
||||
//Is it a instance actor?
|
||||
if (ownerActor == null)
|
||||
ownerActor = session.GetActor().zone.FindActorInArea(eventStart.ownerActorID);
|
||||
ownerActor = session.GetActor().CurrentArea.FindActorInArea(eventStart.ownerActorID);
|
||||
//Is it a Director?
|
||||
if (ownerActor == null)
|
||||
{
|
||||
|
@ -40,9 +40,10 @@ namespace Meteor.Map.packets.send.actor.events
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
binWriter.Write((Byte)condition.unknown1); //4
|
||||
binWriter.Write((UInt16)condition.emoteId); //82, 76, 6E
|
||||
binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
|
||||
binWriter.Write((Byte)4); //Id type? Priority
|
||||
binWriter.Write((Byte)condition.unknown2);
|
||||
binWriter.Write((UInt16)condition.emoteId); //82, 76, 6E are emotes used in captures
|
||||
binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(condition.conditionName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace Meteor.Map.packets.send.actor.events
|
||||
{
|
||||
binWriter.Write((Byte)condition.unknown1); //Seen: 0, 1, E
|
||||
binWriter.Write((Byte)condition.unknown2); //Seen: 0, 1
|
||||
binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
|
||||
binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(condition.conditionName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace Meteor.Map.packets.send.actor
|
||||
public const ushort OPCODE = 0x013D;
|
||||
public const uint PACKET_SIZE = 0x48;
|
||||
|
||||
public static SubPacket BuildPacket(uint sourceActorId, uint displayNameID, string customName, bool isSexMale = true)
|
||||
public static SubPacket BuildPacket(uint sourceActorId, int displayNameID, string customName, bool isSexMale = true)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
@ -42,7 +42,7 @@ namespace Meteor.Map.packets.send.actor
|
||||
{
|
||||
binWriter.Write((UInt32)displayNameID);
|
||||
|
||||
if (customName != null && (displayNameID == 0 || displayNameID == 0xFFFFFFFF))
|
||||
if (customName != null && (displayNameID == 0 || displayNameID == -1))
|
||||
{
|
||||
binWriter.Write(Encoding.ASCII.GetBytes(customName), 0, Encoding.ASCII.GetByteCount(customName) >= 0x20 ? 0x19 : Encoding.ASCII.GetByteCount(customName));
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace Meteor.Map.packets.send
|
||||
public const ushort OPCODE = 0x0005;
|
||||
public const uint PACKET_SIZE = 0x30;
|
||||
|
||||
public static SubPacket BuildPacket(uint playerActorID, uint mapID, uint regionID)
|
||||
public static SubPacket BuildPacket(uint playerActorID, uint regionId, uint placeId)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
@ -38,8 +38,8 @@ namespace Meteor.Map.packets.send
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
binWriter.Write((uint)mapID);
|
||||
binWriter.Write((uint)regionID);
|
||||
binWriter.Write((uint)regionId);
|
||||
binWriter.Write((uint)placeId);
|
||||
binWriter.Write((uint)0x28);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,6 @@ namespace Meteor.Map
|
||||
|
||||
mWorldManager = new WorldManager(this);
|
||||
mWorldManager.LoadZoneList();
|
||||
mWorldManager.LoadZoneEntranceList();
|
||||
mWorldManager.LoadSeamlessBoundryList();
|
||||
mWorldManager.LoadActorClasses();
|
||||
mWorldManager.LoadSpawnLocations();
|
||||
|
@ -49,7 +49,6 @@ namespace Meteor.Map
|
||||
private WorldMaster worldMaster = new WorldMaster();
|
||||
private Dictionary<uint, Zone> zoneList;
|
||||
private Dictionary<uint, List<SeamlessBoundry>> seamlessBoundryList;
|
||||
private Dictionary<uint, ZoneEntrance> zoneEntranceList;
|
||||
private Dictionary<uint, ActorClass> actorClasses = new Dictionary<uint,ActorClass>();
|
||||
private Dictionary<ulong, Party> currentPlayerParties = new Dictionary<ulong, Party>(); //GroupId, Party object
|
||||
private Dictionary<uint, StatusEffect> statusEffectList = new Dictionary<uint, StatusEffect>();
|
||||
@ -120,7 +119,7 @@ namespace Meteor.Map
|
||||
{
|
||||
Zone zone = new Zone(reader.GetUInt32(0), reader.GetString(1), reader.GetUInt16(2), reader.GetString(3), reader.GetUInt16(4), reader.GetUInt16(5),
|
||||
reader.GetUInt16(6), reader.GetBoolean(7), reader.GetBoolean(8), reader.GetBoolean(9), reader.GetBoolean(10), reader.GetBoolean(11), reader.GetBoolean(12));
|
||||
zoneList[zone.actorId] = zone;
|
||||
zoneList[zone.ZoneId] = zone;
|
||||
count1++;
|
||||
}
|
||||
}
|
||||
@ -141,7 +140,6 @@ namespace Meteor.Map
|
||||
|
||||
string query = @"
|
||||
SELECT
|
||||
id,
|
||||
parentZoneId,
|
||||
privateAreaName,
|
||||
privateAreaType,
|
||||
@ -163,7 +161,7 @@ namespace Meteor.Map
|
||||
if (zoneList.ContainsKey(parentZoneId))
|
||||
{
|
||||
Zone parent = zoneList[parentZoneId];
|
||||
PrivateArea privArea = new PrivateArea(parent, reader.GetUInt32("id"), reader.GetString("className"), reader.GetString("privateAreaName"), reader.GetUInt32("privateAreaType"), reader.GetUInt16("dayMusic"), reader.GetUInt16("nightMusic"), reader.GetUInt16("battleMusic"));
|
||||
PrivateArea privArea = new PrivateArea(parent, reader.GetString("className"), reader.GetString("privateAreaName"), reader.GetInt32("privateAreaType"), reader.GetUInt16("dayMusic"), reader.GetUInt16("nightMusic"), reader.GetUInt16("battleMusic"));
|
||||
parent.AddPrivateArea(privArea);
|
||||
}
|
||||
else
|
||||
@ -184,57 +182,6 @@ namespace Meteor.Map
|
||||
Program.Log.Info(String.Format("Loaded {0} zones and {1} private areas.", count1, count2));
|
||||
}
|
||||
|
||||
public void LoadZoneEntranceList()
|
||||
{
|
||||
zoneEntranceList = new Dictionary<uint, ZoneEntrance>();
|
||||
int count = 0;
|
||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
{
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
string query = @"
|
||||
SELECT
|
||||
id,
|
||||
zoneId,
|
||||
spawnType,
|
||||
spawnX,
|
||||
spawnY,
|
||||
spawnZ,
|
||||
spawnRotation,
|
||||
privateAreaName
|
||||
FROM server_zones_spawnlocations";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
uint id = reader.GetUInt32(0);
|
||||
string privArea = null;
|
||||
|
||||
if (!reader.IsDBNull(7))
|
||||
privArea = reader.GetString(7);
|
||||
|
||||
ZoneEntrance entance = new ZoneEntrance(reader.GetUInt32(1), privArea, 1, reader.GetByte(2), reader.GetFloat(3), reader.GetFloat(4), reader.GetFloat(5), reader.GetFloat(6));
|
||||
zoneEntranceList[id] = entance;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{ Console.WriteLine(e); }
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Program.Log.Info(String.Format("Loaded {0} zone spawn locations.", count));
|
||||
}
|
||||
|
||||
public void LoadSeamlessBoundryList()
|
||||
{
|
||||
seamlessBoundryList = new Dictionary<uint, List<SeamlessBoundry>>();
|
||||
@ -329,7 +276,7 @@ namespace Meteor.Map
|
||||
{
|
||||
uint id = reader.GetUInt32("id");
|
||||
string classPath = reader.GetString("classPath");
|
||||
uint nameId = reader.GetUInt32("displayNameId");
|
||||
int nameId = reader.GetInt32("displayNameId");
|
||||
string eventConditions = null;
|
||||
|
||||
uint propertyFlags = reader.GetUInt32("propertyFlags");
|
||||
@ -415,7 +362,7 @@ namespace Meteor.Map
|
||||
customName = reader.GetString("customDisplayName");
|
||||
string uniqueId = reader.GetString("uniqueId");
|
||||
string privAreaName = reader.GetString("privateAreaName");
|
||||
uint privAreaLevel = reader.GetUInt32("privateAreaLevel");
|
||||
int privAreaType = reader.GetInt32("privateAreaLevel");
|
||||
float x = reader.GetFloat("positionX");
|
||||
float y = reader.GetFloat("positionY");
|
||||
float z = reader.GetFloat("positionZ");
|
||||
@ -423,7 +370,7 @@ namespace Meteor.Map
|
||||
ushort state = reader.GetUInt16("actorState");
|
||||
uint animId = reader.GetUInt32("animationId");
|
||||
|
||||
SpawnLocation spawn = new SpawnLocation(classId, uniqueId, zoneId, privAreaName, privAreaLevel, x, y, z, rot, state, animId);
|
||||
SpawnLocation spawn = new SpawnLocation(classId, uniqueId, zoneId, privAreaName, privAreaType, x, y, z, rot, state, animId);
|
||||
|
||||
zone.AddSpawnLocation(spawn);
|
||||
|
||||
@ -599,7 +546,7 @@ namespace Meteor.Map
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
area = area ?? Server.GetWorldManager().GetZone(reader.GetUInt16("zoneId"));
|
||||
area = area ?? Server.GetWorldManager().GetArea(reader.GetUInt16("zoneId"));
|
||||
int actorId = area.GetActorCount() + 1;
|
||||
bnpc = area.GetBattleNpcById(id);
|
||||
|
||||
@ -764,14 +711,14 @@ namespace Meteor.Map
|
||||
{
|
||||
Area oldZone;
|
||||
|
||||
if (player.zone != null)
|
||||
if (player.CurrentArea != null)
|
||||
{
|
||||
oldZone = player.zone;
|
||||
oldZone = player.CurrentArea;
|
||||
oldZone.RemoveActorFromZone(player);
|
||||
}
|
||||
|
||||
//Add player to new zone and update
|
||||
Zone newZone = GetZone(destinationZoneId);
|
||||
Area newZone = GetArea(destinationZoneId);
|
||||
|
||||
//This server does not contain that zoneId
|
||||
if (newZone == null)
|
||||
@ -779,11 +726,9 @@ namespace Meteor.Map
|
||||
|
||||
newZone.AddActorToZone(player);
|
||||
|
||||
player.zone = newZone;
|
||||
player.zoneId = destinationZoneId;
|
||||
player.CurrentArea = newZone;
|
||||
|
||||
player.zone2 = null;
|
||||
player.zoneId2 = 0;
|
||||
|
||||
player.SendSeamlessZoneInPackets();
|
||||
|
||||
@ -796,7 +741,7 @@ namespace Meteor.Map
|
||||
public void MergeZones(Player player, uint mergedZoneId)
|
||||
{
|
||||
//Add player to new zone and update
|
||||
Zone mergedZone = GetZone(mergedZoneId);
|
||||
Area mergedZone = GetArea(mergedZoneId);
|
||||
|
||||
//This server does not contain that zoneId
|
||||
if (mergedZone == null)
|
||||
@ -805,7 +750,6 @@ namespace Meteor.Map
|
||||
mergedZone.AddActorToZone(player);
|
||||
|
||||
player.zone2 = mergedZone;
|
||||
player.zoneId2 = mergedZone.actorId;
|
||||
|
||||
player.SendMessage(0x20, "", "Merging Zones");
|
||||
|
||||
@ -826,26 +770,29 @@ namespace Meteor.Map
|
||||
* ->If merge box, MergeZones
|
||||
*/
|
||||
|
||||
if (player.zone == null)
|
||||
if (player.CurrentArea == null)
|
||||
return;
|
||||
|
||||
uint regionId = player.zone.regionId;
|
||||
uint regionId = player.CurrentArea.RegionId;
|
||||
|
||||
if (!seamlessBoundryList.ContainsKey(regionId))
|
||||
return;
|
||||
|
||||
foreach (SeamlessBoundry bounds in seamlessBoundryList[regionId])
|
||||
{
|
||||
uint zoneId = player.CurrentArea.ZoneId;
|
||||
uint zoneId2 = player.zone2.ZoneId;
|
||||
|
||||
if (CheckPosInBounds(player.positionX, player.positionZ, bounds.zone1_x1, bounds.zone1_y1, bounds.zone1_x2, bounds.zone1_y2))
|
||||
{
|
||||
if (player.zoneId == bounds.zoneId1 && player.zoneId2 == 0)
|
||||
if (zoneId == bounds.zoneId1 && zoneId2 == 0)
|
||||
return;
|
||||
|
||||
DoSeamlessZoneChange(player, bounds.zoneId1);
|
||||
}
|
||||
else if (CheckPosInBounds(player.positionX, player.positionZ, bounds.zone2_x1, bounds.zone2_y1, bounds.zone2_x2, bounds.zone2_y2))
|
||||
{
|
||||
if (player.zoneId == bounds.zoneId2 && player.zoneId2 == 0)
|
||||
if (zoneId == bounds.zoneId2 && zoneId2 == 0)
|
||||
return;
|
||||
|
||||
DoSeamlessZoneChange(player, bounds.zoneId2);
|
||||
@ -853,13 +800,13 @@ namespace Meteor.Map
|
||||
else if (CheckPosInBounds(player.positionX, player.positionZ, bounds.merge_x1, bounds.merge_y1, bounds.merge_x2, bounds.merge_y2))
|
||||
{
|
||||
uint merged;
|
||||
if (player.zoneId == bounds.zoneId1)
|
||||
if (zoneId == bounds.zoneId1)
|
||||
merged = bounds.zoneId2;
|
||||
else
|
||||
merged = bounds.zoneId1;
|
||||
|
||||
//Already merged
|
||||
if (player.zoneId2 == merged)
|
||||
if (zoneId2 == merged)
|
||||
return;
|
||||
|
||||
MergeZones(player, merged);
|
||||
@ -881,29 +828,12 @@ namespace Meteor.Map
|
||||
return xIsGood && yIsGood;
|
||||
}
|
||||
|
||||
//Moves actor to new zone, and sends packets to spawn at the given zone entrance
|
||||
public void DoZoneChange(Player player, uint zoneEntrance)
|
||||
{
|
||||
if (!zoneEntranceList.ContainsKey(zoneEntrance))
|
||||
{
|
||||
Program.Log.Error("Given zone entrance was not found: " + zoneEntrance);
|
||||
return;
|
||||
}
|
||||
|
||||
ZoneEntrance ze = zoneEntranceList[zoneEntrance];
|
||||
DoZoneChange(player, ze.zoneId, ze.privateAreaName, ze.privateAreaType, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation);
|
||||
}
|
||||
|
||||
//Moves actor to new zone, and sends packets to spawn at the given coords.
|
||||
public void DoZoneChange(Player player, uint destinationZoneId, string destinationPrivateArea, int destinationPrivateAreaType, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
|
||||
{
|
||||
//Add player to new zone and update
|
||||
Area newArea;
|
||||
|
||||
if (destinationPrivateArea == null)
|
||||
newArea = GetZone(destinationZoneId);
|
||||
else //Add check for -1 if it is a instance
|
||||
newArea = GetZone(destinationZoneId).GetPrivateArea(destinationPrivateArea, (uint)destinationPrivateAreaType);
|
||||
//Add check for -1 if it is a instance
|
||||
Area newArea = GetArea(destinationZoneId, destinationPrivateArea, destinationPrivateAreaType);
|
||||
|
||||
//This server does not contain that zoneId
|
||||
if (newArea == null)
|
||||
@ -915,20 +845,16 @@ namespace Meteor.Map
|
||||
|
||||
player.playerSession.LockUpdates(true);
|
||||
|
||||
Area oldZone = player.zone;
|
||||
Area oldArea = player.CurrentArea;
|
||||
//Remove player from currentZone if transfer else it's login
|
||||
if (player.zone != null)
|
||||
if (player.CurrentArea != null)
|
||||
{
|
||||
oldZone.RemoveActorFromZone(player);
|
||||
oldArea.RemoveActorFromZone(player);
|
||||
}
|
||||
newArea.AddActorToZone(player);
|
||||
|
||||
//Update player actor's properties
|
||||
player.zoneId = newArea is PrivateArea ? ((PrivateArea)newArea).GetParentZone().actorId : newArea.actorId;
|
||||
|
||||
player.privateArea = newArea is PrivateArea ? ((PrivateArea)newArea).GetPrivateAreaName() : null;
|
||||
player.privateAreaType = newArea is PrivateArea ? ((PrivateArea)newArea).GetPrivateAreaType() : 0;
|
||||
player.zone = newArea;
|
||||
player.CurrentArea = newArea;
|
||||
player.positionX = spawnX;
|
||||
player.positionY = spawnY;
|
||||
player.positionZ = spawnZ;
|
||||
@ -945,8 +871,8 @@ namespace Meteor.Map
|
||||
player.currentContentGroup.RemoveMember(player.actorId);
|
||||
player.SetCurrentContentGroup(null);
|
||||
|
||||
if (oldZone is PrivateAreaContent)
|
||||
((PrivateAreaContent)oldZone).CheckDestroy();
|
||||
if (oldArea is PrivateAreaContent)
|
||||
((PrivateAreaContent)oldArea).CheckDestroy();
|
||||
}
|
||||
|
||||
//Send packets
|
||||
@ -965,32 +891,15 @@ namespace Meteor.Map
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, newArea, "onZoneIn", true);
|
||||
}
|
||||
|
||||
//Moves actor within zone to spawn position
|
||||
public void DoPlayerMoveInZone(Player player, uint zoneEntrance)
|
||||
{
|
||||
if (!zoneEntranceList.ContainsKey(zoneEntrance))
|
||||
{
|
||||
Program.Log.Error("Given zone entrance was not found: " + zoneEntrance);
|
||||
return;
|
||||
}
|
||||
|
||||
ZoneEntrance ze = zoneEntranceList[zoneEntrance];
|
||||
|
||||
if (ze.zoneId != player.zoneId)
|
||||
return;
|
||||
|
||||
DoPlayerMoveInZone(player, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation, ze.spawnType);
|
||||
}
|
||||
|
||||
//Moves actor within the zone
|
||||
public void DoPlayerMoveInZone(Player player, float spawnX, float spawnY, float spawnZ, float spawnRotation, byte spawnType = 0xF)
|
||||
{
|
||||
//Remove player from currentZone if transfer else it's login
|
||||
if (player.zone != null)
|
||||
if (player.CurrentArea != null)
|
||||
{
|
||||
player.playerSession.LockUpdates(true);
|
||||
player.zone.RemoveActorFromZone(player);
|
||||
player.zone.AddActorToZone(player);
|
||||
player.CurrentArea.RemoveActorFromZone(player);
|
||||
player.CurrentArea.AddActorToZone(player);
|
||||
|
||||
//Update player actor's properties;
|
||||
player.positionX = spawnX;
|
||||
@ -1019,21 +928,17 @@ namespace Meteor.Map
|
||||
|
||||
player.playerSession.LockUpdates(true);
|
||||
|
||||
Area oldZone = player.zone;
|
||||
Area oldArea = player.CurrentArea;
|
||||
//Remove player from currentZone if transfer else it's login
|
||||
if (player.zone != null)
|
||||
if (player.CurrentArea != null)
|
||||
{
|
||||
oldZone.RemoveActorFromZone(player);
|
||||
oldArea.RemoveActorFromZone(player);
|
||||
}
|
||||
|
||||
contentArea.AddActorToZone(player);
|
||||
|
||||
//Update player actor's properties
|
||||
player.zoneId = contentArea.GetParentZone().actorId;
|
||||
|
||||
player.privateArea = contentArea.GetPrivateAreaName();
|
||||
player.privateAreaType = contentArea.GetPrivateAreaType();
|
||||
player.zone = contentArea;
|
||||
player.CurrentArea = contentArea;
|
||||
player.positionX = spawnX;
|
||||
player.positionY = spawnY;
|
||||
player.positionZ = spawnZ;
|
||||
@ -1058,18 +963,14 @@ namespace Meteor.Map
|
||||
public void DoZoneIn(Player player, bool isLogin, ushort spawnType)
|
||||
{
|
||||
//Add player to new zone and update
|
||||
Area playerArea;
|
||||
if (player.privateArea != null)
|
||||
playerArea = GetPrivateArea(player.zoneId, player.privateArea, player.privateAreaType);
|
||||
else
|
||||
playerArea = GetZone(player.zoneId);
|
||||
Area playerArea = player.CurrentArea;
|
||||
|
||||
//This server does not contain that zoneId
|
||||
if (playerArea == null)
|
||||
return;
|
||||
|
||||
//Set the current zone and add player
|
||||
player.zone = playerArea;
|
||||
player.CurrentArea = playerArea;
|
||||
|
||||
playerArea.AddActorToZone(player);
|
||||
|
||||
@ -1319,7 +1220,7 @@ namespace Meteor.Map
|
||||
return;
|
||||
}
|
||||
|
||||
Player inviter = (Player)invitee.GetZone().FindActorInArea(group.GetHost());
|
||||
Player inviter = (Player)invitee.CurrentArea.FindActorInArea(group.GetHost());
|
||||
|
||||
//DeleteTradeGroup(group.groupIndex);
|
||||
|
||||
@ -1340,7 +1241,7 @@ namespace Meteor.Map
|
||||
return;
|
||||
}
|
||||
|
||||
Player invitee = (Player)inviter.GetZone().FindActorInArea(group.GetOther());
|
||||
Player invitee = (Player)inviter.CurrentArea.FindActorInArea(group.GetOther());
|
||||
|
||||
inviter.SendGameMessage(GetActor(), 25042, 0x20); //You cancel the trade.
|
||||
if (invitee != null)
|
||||
@ -1359,7 +1260,7 @@ namespace Meteor.Map
|
||||
return;
|
||||
}
|
||||
|
||||
Player invitee = (Player)inviter.GetZone().FindActorInArea(group.GetOther());
|
||||
Player invitee = (Player)inviter.CurrentArea.FindActorInArea(group.GetOther());
|
||||
|
||||
inviter.SendGameMessage(GetActor(), 25041, 0x20); //You cancel the trade.
|
||||
if (invitee != null)
|
||||
@ -1378,7 +1279,7 @@ namespace Meteor.Map
|
||||
return;
|
||||
}
|
||||
|
||||
Player inviter = (Player)invitee.GetZone().FindActorInArea(group.GetHost());
|
||||
Player inviter = (Player)invitee.CurrentArea.FindActorInArea(group.GetHost());
|
||||
|
||||
if (inviter != null)
|
||||
inviter.SendGameMessage(GetActor(), 25038, 0x20); //Your trade request fails
|
||||
@ -1891,25 +1792,17 @@ namespace Meteor.Map
|
||||
return null;
|
||||
}
|
||||
|
||||
public Zone GetZone(uint zoneId)
|
||||
public Area GetArea(uint zoneId, string privateAreaName = "", int privateAreaType = 0)
|
||||
{
|
||||
lock (zoneList)
|
||||
{
|
||||
if (!zoneList.ContainsKey(zoneId))
|
||||
return null;
|
||||
|
||||
if (privateAreaName == null || privateAreaName.Equals(""))
|
||||
return zoneList[zoneId];
|
||||
}
|
||||
}
|
||||
|
||||
public PrivateArea GetPrivateArea(uint zoneId, string privateArea, uint privateAreaType)
|
||||
{
|
||||
lock (zoneList)
|
||||
{
|
||||
if (!zoneList.ContainsKey(zoneId))
|
||||
return null;
|
||||
|
||||
return zoneList[zoneId].GetPrivateArea(privateArea, privateAreaType);
|
||||
else
|
||||
return zoneList[zoneId].GetPrivateArea(privateAreaName, privateAreaType);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1947,14 +1840,6 @@ namespace Meteor.Map
|
||||
}
|
||||
}
|
||||
|
||||
public ZoneEntrance GetZoneEntrance(uint entranceId)
|
||||
{
|
||||
if (zoneEntranceList.ContainsKey(entranceId))
|
||||
return zoneEntranceList[entranceId];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public ActorClass GetActorClass(uint id)
|
||||
{
|
||||
if (actorClasses.ContainsKey(id))
|
||||
|
@ -71,7 +71,6 @@ namespace Meteor.World
|
||||
|
||||
mWorldManager = new WorldManager(this);
|
||||
mWorldManager.LoadZoneServerList();
|
||||
mWorldManager.LoadZoneEntranceList();
|
||||
mWorldManager.ConnectToZoneServers();
|
||||
|
||||
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), int.Parse(ConfigConstants.OPTIONS_PORT));
|
||||
|
@ -107,57 +107,6 @@ namespace Meteor.World
|
||||
|
||||
}
|
||||
|
||||
public void LoadZoneEntranceList()
|
||||
{
|
||||
zoneEntranceList = new Dictionary<uint, ZoneEntrance>();
|
||||
int count = 0;
|
||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
{
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
string query = @"
|
||||
SELECT
|
||||
id,
|
||||
zoneId,
|
||||
spawnType,
|
||||
spawnX,
|
||||
spawnY,
|
||||
spawnZ,
|
||||
spawnRotation,
|
||||
privateAreaName
|
||||
FROM server_zones_spawnlocations";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
uint id = reader.GetUInt32(0);
|
||||
string privArea = null;
|
||||
|
||||
if (!reader.IsDBNull(7))
|
||||
privArea = reader.GetString(7);
|
||||
|
||||
ZoneEntrance entance = new ZoneEntrance(reader.GetUInt32(1), privArea, reader.GetByte(2), reader.GetFloat(3), reader.GetFloat(4), reader.GetFloat(5), reader.GetFloat(6));
|
||||
zoneEntranceList[id] = entance;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{ Console.WriteLine(e); }
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Program.Log.Info(String.Format("Loaded {0} zone spawn locations.", count));
|
||||
}
|
||||
|
||||
public void ConnectToZoneServers()
|
||||
{
|
||||
Program.Log.Info("--------------------------");
|
||||
|
Loading…
Reference in New Issue
Block a user