mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-27 21:06:08 +02:00
Finished the crafting start window system. Added PassiveGuildleveQuests and refactors the Quest object. Cleaned up how zone music is handled.
This commit is contained in:
parent
f4e2280de8
commit
605b4918e2
34 changed files with 7121 additions and 4533 deletions
|
@ -363,7 +363,7 @@ namespace Meteor.Map.Actors
|
|||
return packets;
|
||||
}
|
||||
|
||||
public override bool Equals(Object obj)
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
Actor actorObj = obj as Actor;
|
||||
if (actorObj == null)
|
||||
|
@ -508,7 +508,7 @@ namespace Meteor.Map.Actors
|
|||
.Replace("Object", "Obj")
|
||||
.Replace("Retainer", "Rtn")
|
||||
.Replace("Standard", "Std");
|
||||
className = Char.ToLowerInvariant(className[0]) + className.Substring(1);
|
||||
className = char.ToLowerInvariant(className[0]) + className.Substring(1);
|
||||
|
||||
//Format Zone Name
|
||||
string zoneName = zone.zoneName.Replace("Field", "Fld")
|
||||
|
@ -524,7 +524,7 @@ namespace Meteor.Map.Actors
|
|||
//Check if "normal"
|
||||
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
|
||||
{
|
||||
|
@ -542,7 +542,7 @@ namespace Meteor.Map.Actors
|
|||
if (zone is PrivateArea)
|
||||
privLevel = ((PrivateArea)zone).GetPrivateAreaType();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public bool SetWorkValue(Player player, string name, string uiFunc, object value)
|
||||
|
@ -553,8 +553,8 @@ namespace Meteor.Map.Actors
|
|||
if (!(split[0].Equals("work") || split[0].Equals("charaWork") || split[0].Equals("playerWork") || split[0].Equals("npcWork")))
|
||||
return false;
|
||||
|
||||
Object parentObj = null;
|
||||
Object curObj = this;
|
||||
object parentObj = null;
|
||||
object curObj = this;
|
||||
for (int i = 0; i < split.Length; i++)
|
||||
{
|
||||
//For arrays
|
||||
|
@ -759,7 +759,7 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
if (target == null)
|
||||
{
|
||||
Program.Log.Error(String.Format("[{0} {1}] FindRandomPointAroundTarget: no target found!", this.actorId, this.customDisplayName));
|
||||
Program.Log.Error(string.Format("[{0} {1}] FindRandomPointAroundTarget: no target found!", this.actorId, this.customDisplayName));
|
||||
return GetPosAsVector3();
|
||||
}
|
||||
return FindRandomPoint(target.positionX, target.positionY, target.positionZ, minRadius, maxRadius);
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Meteor.Map.Actors
|
|||
protected int halfWidth, halfHeight;
|
||||
|
||||
private Dictionary<uint, Director> currentDirectors = new Dictionary<uint, Director>();
|
||||
private Object directorLock = new Object();
|
||||
private object directorLock = new object();
|
||||
private uint directorIdCount = 0;
|
||||
|
||||
protected Director mWeatherDirector;
|
||||
|
@ -77,7 +77,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}", id << 8);
|
||||
|
||||
this.classPath = classPath;
|
||||
this.className = classPath.Substring(classPath.LastIndexOf("/") + 1);
|
||||
|
@ -611,7 +611,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
public Director CreateGuildleveDirector(uint glid, byte difficulty, Player owner, params object[] args)
|
||||
{
|
||||
String directorScriptPath = "";
|
||||
string directorScriptPath = "";
|
||||
|
||||
uint type = Server.GetGuildleveGamedata(glid).plateId;
|
||||
|
||||
|
@ -677,6 +677,11 @@ namespace Meteor.Map.Actors
|
|||
return null;
|
||||
}
|
||||
|
||||
public ushort GetCurrentMusic()
|
||||
{
|
||||
return bgmDay;
|
||||
}
|
||||
|
||||
public override void Update(DateTime tick)
|
||||
{
|
||||
lock (mActorList)
|
||||
|
@ -691,6 +696,5 @@ namespace Meteor.Map.Actors
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Meteor.Map.actors.area
|
|||
private Director currentDirector;
|
||||
private bool isContentFinished = false;
|
||||
|
||||
public static PrivateAreaContent CreateContentArea(String scriptPath)
|
||||
public static PrivateAreaContent CreateContentArea(string scriptPath)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -33,14 +33,14 @@ namespace Meteor.Map.actors.area
|
|||
{
|
||||
Dictionary<string, Dictionary<uint, PrivateArea>> privateAreas = new Dictionary<string, Dictionary<uint, PrivateArea>>();
|
||||
Dictionary<string, List<PrivateAreaContent>> contentAreas = new Dictionary<string, List<PrivateAreaContent>>();
|
||||
Object contentAreasLock = new Object();
|
||||
object contentAreasLock = new object();
|
||||
|
||||
public SharpNav.TiledNavMesh tiledNavMesh;
|
||||
public SharpNav.NavMeshQuery navMeshQuery;
|
||||
|
||||
public Int64 pathCalls;
|
||||
public Int64 prevPathCalls = 0;
|
||||
public Int64 pathCallTime;
|
||||
public long pathCalls;
|
||||
public long prevPathCalls = 0;
|
||||
public long pathCallTime;
|
||||
|
||||
public Zone(uint id, string zoneName, ushort regionId, string classPath, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid, bool loadNavMesh = false)
|
||||
: base(id, zoneName, regionId, classPath, bgmDay, bgmNight, bgmBattle, isIsolated, isInn, canRideChocobo, canStealth, isInstanceRaid)
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace Meteor.Map.Actors
|
|||
public uint extraUint;
|
||||
public float extraFloat;
|
||||
|
||||
protected Dictionary<string, UInt64> tempVars = new Dictionary<string, UInt64>();
|
||||
protected Dictionary<string, ulong> tempVars = new Dictionary<string, ulong>();
|
||||
|
||||
//Inventory
|
||||
protected Dictionary<ushort, ItemPackage> itemPackages = new Dictionary<ushort, ItemPackage>();
|
||||
|
@ -227,8 +227,8 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
if (!effect.GetHidden())
|
||||
{
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.statusShownTime[{0}]", i));
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.statusShownTime[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.statusShownTime[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.statusShownTime[{0}]", i));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -908,9 +908,9 @@ namespace Meteor.Map.Actors
|
|||
AddTP((int)Math.Ceiling(tpModifier * action.amount));
|
||||
}
|
||||
|
||||
public UInt64 GetTempVar(string name)
|
||||
public ulong GetTempVar(string name)
|
||||
{
|
||||
UInt64 retVal = 0;
|
||||
ulong retVal = 0;
|
||||
if (tempVars.TryGetValue(name, out retVal))
|
||||
return retVal;
|
||||
return 0;
|
||||
|
@ -923,7 +923,7 @@ namespace Meteor.Map.Actors
|
|||
tempVars[name] = val;
|
||||
}
|
||||
|
||||
public void SetTempVar(string name, UInt64 val)
|
||||
public void SetTempVar(string name, ulong val)
|
||||
{
|
||||
if (tempVars.ContainsKey(name))
|
||||
tempVars[name] = val;
|
||||
|
@ -994,7 +994,7 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
shouldSend = true;
|
||||
charaWork.battleTemp.timingCommandFlag[i] = false;
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.battleTemp.timingCommandFlag[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.battleTemp.timingCommandFlag[{0}]", i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ namespace Meteor.Map.Actors
|
|||
if (this is Player)
|
||||
{
|
||||
var propPacketUtil = new ActorPropertyPacketUtil("charaWork/timingCommand", this);
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.battleTemp.timingCommandFlag[{0}]", procId));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.battleTemp.timingCommandFlag[{0}]", procId));
|
||||
((Player)this).QueuePackets(propPacketUtil.Done());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Meteor.Map.actors.chara
|
|||
//These will need to be redone at some point. remember to update tables in db.
|
||||
//Consider using text_paramname sheet. that matches up with the stats on armor, but some things will need special handling
|
||||
//Also, 0-35 should probably match with up BattleTemp
|
||||
enum Modifier : UInt32
|
||||
enum Modifier : uint
|
||||
{
|
||||
//These line up with ParamNames starting at 15001 and appear on gear
|
||||
//Health
|
||||
|
|
|
@ -27,9 +27,9 @@ namespace Meteor.Map.actors.chara
|
|||
class ModifierListEntry
|
||||
{
|
||||
public uint id;
|
||||
public Int64 value;
|
||||
public long value;
|
||||
|
||||
public ModifierListEntry(uint id, Int64 value)
|
||||
public ModifierListEntry(uint id, long value)
|
||||
{
|
||||
this.id = id;
|
||||
this.value = value;
|
||||
|
@ -47,13 +47,13 @@ namespace Meteor.Map.actors.chara
|
|||
mobModList = new Dictionary<uint, ModifierListEntry>();
|
||||
}
|
||||
|
||||
public void AddModifier(uint id, Int64 val, bool isMobMod)
|
||||
public void AddModifier(uint id, long val, bool isMobMod)
|
||||
{
|
||||
var list = isMobMod ? mobModList : modList;
|
||||
list.Add(id, new ModifierListEntry(id, val));
|
||||
}
|
||||
|
||||
public void SetModifier(uint id, Int64 val, bool isMobMod)
|
||||
public void SetModifier(uint id, long val, bool isMobMod)
|
||||
{
|
||||
var list = isMobMod ? mobModList : modList;
|
||||
if (list.ContainsKey(id))
|
||||
|
@ -62,7 +62,7 @@ namespace Meteor.Map.actors.chara
|
|||
list.Add(id, new ModifierListEntry(id, val));
|
||||
}
|
||||
|
||||
public Int64 GetModifier(uint id, bool isMobMod)
|
||||
public long GetModifier(uint id, bool isMobMod)
|
||||
{
|
||||
ModifierListEntry retVal;
|
||||
var list = isMobMod ? mobModList : modList;
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace Meteor.Map.Actors
|
|||
public ModifierList genusMods;
|
||||
public ModifierList spawnMods;
|
||||
|
||||
protected Dictionary<MobModifier, Int64> mobModifiers = new Dictionary<MobModifier, Int64>();
|
||||
protected Dictionary<MobModifier, long> mobModifiers = new Dictionary<MobModifier, long>();
|
||||
|
||||
public BattleNpc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot,
|
||||
ushort actorState, uint animationId, string customDisplayName)
|
||||
|
@ -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, GetZone().GetName());
|
||||
Program.Log.Error(err);
|
||||
//throw new Exception(err);
|
||||
}
|
||||
|
@ -434,20 +434,20 @@ namespace Meteor.Map.Actors
|
|||
this.bnpcId = id;
|
||||
}
|
||||
|
||||
public Int64 GetMobMod(MobModifier mobMod)
|
||||
public long GetMobMod(MobModifier mobMod)
|
||||
{
|
||||
return GetMobMod((uint)mobMod);
|
||||
}
|
||||
|
||||
public Int64 GetMobMod(uint mobModId)
|
||||
public long GetMobMod(uint mobModId)
|
||||
{
|
||||
Int64 res;
|
||||
long res;
|
||||
if (mobModifiers.TryGetValue((MobModifier)mobModId, out res))
|
||||
return res;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void SetMobMod(uint mobModId, Int64 val)
|
||||
public void SetMobMod(uint mobModId, long val)
|
||||
{
|
||||
if (mobModifiers.ContainsKey((MobModifier)mobModId))
|
||||
mobModifiers[(MobModifier)mobModId] = val;
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Meteor.Map.Actors
|
|||
LoadNpcAppearance(actorClass.actorClassId);
|
||||
|
||||
className = actorClass.classPath.Substring(actorClass.classPath.LastIndexOf("/") + 1);
|
||||
this.classPath = String.Format("{0}/{1}", actorClass.classPath.Substring(0, actorClass.classPath.LastIndexOf('/')).ToLower(), className);
|
||||
this.classPath = string.Format("{0}/{1}", actorClass.classPath.Substring(0, actorClass.classPath.LastIndexOf('/')).ToLower(), className);
|
||||
|
||||
charaWork.battleSave.potencial = 1.0f;
|
||||
|
||||
|
@ -109,8 +109,8 @@ namespace Meteor.Map.Actors
|
|||
isMapObj = false;
|
||||
else
|
||||
{
|
||||
layout = (uint)(Int32)lParams[4].value;
|
||||
instance = (uint)(Int32)lParams[5].value;
|
||||
layout = (uint)(int)lParams[4].value;
|
||||
instance = (uint)(int)lParams[5].value;
|
||||
isStatic = true;
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ namespace Meteor.Map.Actors
|
|||
for (int i = 0; i < charaWork.property.Length; i++)
|
||||
{
|
||||
if (charaWork.property[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.property[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.property[{0}]", i));
|
||||
}
|
||||
|
||||
//Parameters
|
||||
|
@ -261,14 +261,14 @@ namespace Meteor.Map.Actors
|
|||
for (int i = 0; i < charaWork.statusShownTime.Length; i++)
|
||||
{
|
||||
if (charaWork.statusShownTime[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.statusShownTime[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.statusShownTime[{0}]", i));
|
||||
}
|
||||
|
||||
//General Parameters
|
||||
for (int i = 3; i < charaWork.battleTemp.generalParameter.Length; i++)
|
||||
{
|
||||
if (charaWork.battleTemp.generalParameter[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.battleTemp.generalParameter[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.battleTemp.generalParameter[{0}]", i));
|
||||
}
|
||||
|
||||
propPacketUtil.AddProperty("npcWork.hateType");
|
||||
|
@ -302,7 +302,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
public void LoadNpcAppearance(uint id)
|
||||
{
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace Meteor.Map.actors.chara.npc
|
|||
{
|
||||
this.retainerId = retainerId;
|
||||
this.ownerPlayer = player;
|
||||
this.actorName = String.Format("_rtnre{0:x7}", actorId);
|
||||
this.actorName = string.Format("_rtnre{0:x7}", actorId);
|
||||
|
||||
itemPackages[ItemPackage.NORMAL] = new ItemPackage(this, MAXSIZE_INVENTORY_NORMAL, ItemPackage.NORMAL);
|
||||
itemPackages[ItemPackage.CURRENCY_CRYSTALS] = new ItemPackage(this, MAXSIZE_INVENTORY_CURRANCY, ItemPackage.CURRENCY_CRYSTALS);
|
||||
|
|
|
@ -46,6 +46,7 @@ using Meteor.Map.packets.send.actor.battle;
|
|||
using Meteor.Map.packets.receive.events;
|
||||
using static Meteor.Map.LuaUtils;
|
||||
using Meteor.Map.packets.send.actor.events;
|
||||
using Meteor.Map.DataObjects;
|
||||
|
||||
namespace Meteor.Map.Actors
|
||||
{
|
||||
|
@ -146,7 +147,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
//Quest Actors (MUST MATCH playerWork.questScenario/questGuildleve)
|
||||
public Quest[] questScenario = new Quest[16];
|
||||
public uint[] questGuildleve = new uint[8];
|
||||
public Quest[] questGuildleve = new Quest[8];
|
||||
|
||||
//Aetheryte
|
||||
public uint homepoint = 0;
|
||||
|
@ -161,6 +162,10 @@ namespace Meteor.Map.Actors
|
|||
public Retainer currentSpawnedRetainer = null;
|
||||
public bool sentRetainerSpawn = false;
|
||||
|
||||
//Crafting
|
||||
public List<Recipe> recentRecipes = new List<Recipe>();
|
||||
public List<Recipe> awardedRecipes = new List<Recipe>();
|
||||
|
||||
private List<Director> ownedDirectors = new List<Director>();
|
||||
private Director loginInitDirector = null;
|
||||
|
||||
|
@ -173,7 +178,7 @@ namespace Meteor.Map.Actors
|
|||
public Player(Session cp, uint actorID) : base(actorID)
|
||||
{
|
||||
playerSession = cp;
|
||||
actorName = String.Format("_pc{0:00000000}", actorID);
|
||||
actorName = string.Format("_pc{0:00000000}", actorID);
|
||||
className = "Player";
|
||||
|
||||
moveSpeeds[0] = SetActorSpeedPacket.DEFAULT_STOP;
|
||||
|
@ -274,6 +279,17 @@ namespace Meteor.Map.Actors
|
|||
this.aiContainer = new AIContainer(this, new PlayerController(this), null, new TargetFind(this));
|
||||
allegiance = CharacterTargetingAllegiance.Player;
|
||||
CalculateBaseStats();
|
||||
|
||||
AddRecentRecipe(Server.ResolveRecipe().GetRecipeByID(36));
|
||||
AddRecentRecipe(Server.ResolveRecipe().GetRecipeByID(37));
|
||||
AddRecentRecipe(Server.ResolveRecipe().GetRecipeByID(38));
|
||||
AddRecentRecipe(Server.ResolveRecipe().GetRecipeByID(39));
|
||||
AddRecentRecipe(Server.ResolveRecipe().GetRecipeByID(40));
|
||||
AddRecentRecipe(Server.ResolveRecipe().GetRecipeByID(41));
|
||||
AddRecentRecipe(Server.ResolveRecipe().GetRecipeByID(42));
|
||||
AddRecentRecipe(Server.ResolveRecipe().GetRecipeByID(43));
|
||||
AddRecentRecipe(Server.ResolveRecipe().GetRecipeByID(2));
|
||||
AddRecentRecipe(Server.ResolveRecipe().GetRecipeByID(3));
|
||||
}
|
||||
|
||||
public List<SubPacket> Create0x132Packets()
|
||||
|
@ -402,7 +418,7 @@ namespace Meteor.Map.Actors
|
|||
for (int i = 0; i < charaWork.property.Length; i++)
|
||||
{
|
||||
if (charaWork.property[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.property[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.property[{0}]", i));
|
||||
}
|
||||
|
||||
//Parameters
|
||||
|
@ -418,21 +434,21 @@ namespace Meteor.Map.Actors
|
|||
for (int i = 0; i < charaWork.statusShownTime.Length; i++)
|
||||
{
|
||||
if (charaWork.statusShownTime[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.statusShownTime[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.statusShownTime[{0}]", i));
|
||||
}
|
||||
|
||||
//General Parameters
|
||||
for (int i = 3; i < charaWork.battleTemp.generalParameter.Length; i++)
|
||||
{
|
||||
if (charaWork.battleTemp.generalParameter[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.battleTemp.generalParameter[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.battleTemp.generalParameter[{0}]", i));
|
||||
}
|
||||
|
||||
propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[0]");
|
||||
propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[1]");
|
||||
|
||||
//Battle Save Skillpoint
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.battleSave.skillPoint[{0}]", charaWork.parameterSave.state_mainSkill[0] - 1));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.battleSave.skillPoint[{0}]", charaWork.parameterSave.state_mainSkill[0] - 1));
|
||||
|
||||
//Commands
|
||||
propPacketUtil.AddProperty("charaWork.commandBorder");
|
||||
|
@ -443,12 +459,12 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
if (charaWork.command[i] != 0)
|
||||
{
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.command[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.command[{0}]", i));
|
||||
//Recast Timers
|
||||
if (i >= charaWork.commandBorder)
|
||||
{
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.parameterTemp.maxCommandRecastTime[{0}]", i - charaWork.commandBorder));
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", i - charaWork.commandBorder));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.parameterTemp.maxCommandRecastTime[{0}]", i - charaWork.commandBorder));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", i - charaWork.commandBorder));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -457,32 +473,32 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
charaWork.commandCategory[i] = 1;
|
||||
if (charaWork.commandCategory[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.commandCategory[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.commandCategory[{0}]", i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < charaWork.commandAcquired.Length; i++)
|
||||
{
|
||||
if (charaWork.commandAcquired[i] != false)
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.commandAcquired[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.commandAcquired[{0}]", i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++)
|
||||
{
|
||||
if (charaWork.additionalCommandAcquired[i] != false)
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.additionalCommandAcquired[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.additionalCommandAcquired[{0}]", i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < charaWork.parameterSave.commandSlot_compatibility.Length; i++)
|
||||
{
|
||||
charaWork.parameterSave.commandSlot_compatibility[i] = true;
|
||||
if (charaWork.parameterSave.commandSlot_compatibility[i])
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_compatibility[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.parameterSave.commandSlot_compatibility[{0}]", i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < charaWork.parameterSave.commandSlot_recastTime.Length; i++)
|
||||
{
|
||||
if (charaWork.parameterSave.commandSlot_recastTime[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", i));
|
||||
}
|
||||
|
||||
//System
|
||||
|
@ -505,25 +521,25 @@ namespace Meteor.Map.Actors
|
|||
for (int i = 0; i < playerWork.questScenario.Length; i++)
|
||||
{
|
||||
if (playerWork.questScenario[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("playerWork.questScenario[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("playerWork.questScenario[{0}]", i));
|
||||
}
|
||||
|
||||
//Guildleve - Local
|
||||
for (int i = 0; i < playerWork.questGuildleve.Length; i++)
|
||||
{
|
||||
if (playerWork.questGuildleve[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("playerWork.questGuildleve[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("playerWork.questGuildleve[{0}]", i));
|
||||
}
|
||||
|
||||
//Guildleve - Regional
|
||||
for (int i = 0; i < work.guildleveId.Length; i++)
|
||||
{
|
||||
if (work.guildleveId[i] != 0)
|
||||
propPacketUtil.AddProperty(String.Format("work.guildleveId[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("work.guildleveId[{0}]", i));
|
||||
if (work.guildleveDone[i] != false)
|
||||
propPacketUtil.AddProperty(String.Format("work.guildleveDone[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("work.guildleveDone[{0}]", i));
|
||||
if (work.guildleveChecked[i] != false)
|
||||
propPacketUtil.AddProperty(String.Format("work.guildleveChecked[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("work.guildleveChecked[{0}]", i));
|
||||
}
|
||||
|
||||
//Bazaar
|
||||
|
@ -541,9 +557,9 @@ namespace Meteor.Map.Actors
|
|||
for (int i = 0; i < playerWork.npcLinkshellChatCalling.Length; i++)
|
||||
{
|
||||
if (playerWork.npcLinkshellChatCalling[i] != false)
|
||||
propPacketUtil.AddProperty(String.Format("playerWork.npcLinkshellChatCalling[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("playerWork.npcLinkshellChatCalling[{0}]", i));
|
||||
if (playerWork.npcLinkshellChatExtra[i] != false)
|
||||
propPacketUtil.AddProperty(String.Format("playerWork.npcLinkshellChatExtra[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("playerWork.npcLinkshellChatExtra[{0}]", i));
|
||||
}
|
||||
|
||||
propPacketUtil.AddProperty("playerWork.restBonusExpRate");
|
||||
|
@ -560,7 +576,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
public void SendSeamlessZoneInPackets()
|
||||
{
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.bgmDay, SetMusicPacket.EFFECT_FADEIN));
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.GetCurrentMusic(), SetMusicPacket.EFFECT_FADEIN));
|
||||
QueuePacket(SetWeatherPacket.BuildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1));
|
||||
}
|
||||
|
||||
|
@ -583,7 +599,7 @@ namespace Meteor.Map.Actors
|
|||
}
|
||||
}
|
||||
else
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.bgmDay, 0x01)); //Zone
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.GetCurrentMusic(), 0x01)); //Zone
|
||||
|
||||
QueuePacket(SetWeatherPacket.BuildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1));
|
||||
|
||||
|
@ -806,11 +822,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));
|
||||
|
@ -895,6 +906,12 @@ namespace Meteor.Map.Actors
|
|||
QueuePacket(SetMusicPacket.BuildPacket(actorId, musicId, 1));
|
||||
}
|
||||
|
||||
public void ResetMusic()
|
||||
{
|
||||
if (zone != null)
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.GetCurrentMusic(), 1));
|
||||
}
|
||||
|
||||
public void SendMountAppearance()
|
||||
{
|
||||
if (mountState == 1)
|
||||
|
@ -1193,7 +1210,7 @@ namespace Meteor.Map.Actors
|
|||
propertyBuilder.NewTarget("playerWork/expBonus");
|
||||
propertyBuilder.AddProperty("playerWork.restBonusExpRate");
|
||||
propertyBuilder.NewTarget("charaWork/battleStateForSelf");
|
||||
propertyBuilder.AddProperty(String.Format("charaWork.battleSave.skillPoint[{0}]", classId - 1));
|
||||
propertyBuilder.AddProperty(string.Format("charaWork.battleSave.skillPoint[{0}]", classId - 1));
|
||||
Database.LoadHotbar(this);
|
||||
|
||||
var time = Utils.UnixTimeStampUTC();
|
||||
|
@ -1221,7 +1238,7 @@ namespace Meteor.Map.Actors
|
|||
Database.PlayerCharacterUpdateClassLevel(this, classId, level);
|
||||
charaWork.battleSave.skillLevel[classId - 1] = level;
|
||||
ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("charaWork/stateForAll", this);
|
||||
propertyBuilder.AddProperty(String.Format("charaWork.battleSave.skillLevel[{0}]", classId-1));
|
||||
propertyBuilder.AddProperty(string.Format("charaWork.battleSave.skillLevel[{0}]", classId-1));
|
||||
List<SubPacket> packets = propertyBuilder.Done();
|
||||
QueuePackets(packets);
|
||||
}
|
||||
|
@ -1363,6 +1380,16 @@ namespace Meteor.Map.Actors
|
|||
|
||||
return -1;
|
||||
}
|
||||
public int GetFreeQuestGuildleveSlot()
|
||||
{
|
||||
for (int i = 0; i < questGuildleve.Length; i++)
|
||||
{
|
||||
if (questGuildleve[i] == null)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int GetFreeGuildleveSlot()
|
||||
{
|
||||
|
@ -1447,37 +1474,61 @@ namespace Meteor.Map.Actors
|
|||
}
|
||||
}
|
||||
}
|
||||
public void AddQuest(string name, bool isSilent = false)
|
||||
{
|
||||
Actor actor = Server.GetStaticActors(name);
|
||||
AddQuestInternal(actor as Quest, isSilent);
|
||||
}
|
||||
|
||||
public void AddQuest(uint id, bool isSilent = false)
|
||||
{
|
||||
Actor actor = Server.GetStaticActors((0xA0F00000 | id));
|
||||
AddQuest(actor.actorName, isSilent);
|
||||
AddQuestInternal(actor as Quest, isSilent);
|
||||
}
|
||||
|
||||
public void AddQuest(string name, bool isSilent = false)
|
||||
public void AddQuestGuildleve(uint id, byte difficulty)
|
||||
{
|
||||
Actor actor = Server.GetStaticActors(name);
|
||||
|
||||
if (actor == null)
|
||||
Quest staticQuest = (Quest) Server.GetStaticActors((0xA0F00000 | id));
|
||||
if (staticQuest == null)
|
||||
return;
|
||||
|
||||
uint id = actor.actorId;
|
||||
PassiveGuildleve newQuest = new PassiveGuildleve(staticQuest, this, difficulty);
|
||||
|
||||
int freeSlot = GetFreeQuestGuildleveSlot();
|
||||
|
||||
if (freeSlot == -1)
|
||||
return;
|
||||
|
||||
playerWork.questGuildleve[freeSlot] = newQuest.actorId;
|
||||
questGuildleve[freeSlot] = newQuest;
|
||||
|
||||
Database.SaveQuest(this, newQuest);
|
||||
SendQuestGuildleveClientUpdate(freeSlot);
|
||||
}
|
||||
|
||||
private void AddQuestInternal(Quest staticQuest, bool isSilent = false)
|
||||
{
|
||||
if (staticQuest == null)
|
||||
return;
|
||||
|
||||
Scenario newQuest = new Scenario(staticQuest, this, null, 0, 0);
|
||||
|
||||
int freeSlot = GetFreeQuestSlot();
|
||||
|
||||
if (freeSlot == -1)
|
||||
return;
|
||||
|
||||
playerWork.questScenario[freeSlot] = id;
|
||||
questScenario[freeSlot] = new Quest(this, playerWork.questScenario[freeSlot], name, null, 0, 0);
|
||||
Database.SaveQuest(this, questScenario[freeSlot]);
|
||||
playerWork.questScenario[freeSlot] = newQuest.actorId;
|
||||
questScenario[freeSlot] = newQuest;
|
||||
|
||||
Database.SaveQuest(this, newQuest);
|
||||
SendQuestClientUpdate(freeSlot);
|
||||
|
||||
if (!isSilent)
|
||||
{
|
||||
SendGameMessage(Server.GetWorldManager().GetActor(), 25224, 0x20, (object)questScenario[freeSlot].GetQuestId());
|
||||
questScenario[freeSlot].NextPhase(0);
|
||||
}
|
||||
(questScenario[freeSlot] as Scenario).NextPhase(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void CompleteQuest(uint id)
|
||||
|
@ -1541,9 +1592,9 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
if (questScenario[i] != null && questScenario[i].GetQuestId() == oldId)
|
||||
{
|
||||
Actor actor = Server.GetStaticActors((0xA0F00000 | newId));
|
||||
Quest quest = Server.GetStaticActors((0xA0F00000 | newId)) as Quest;
|
||||
playerWork.questScenario[i] = (0xA0F00000 | newId);
|
||||
questScenario[i] = new Quest(this, playerWork.questScenario[i], actor.actorName, null, 0, 0);
|
||||
questScenario[i] = new Scenario(quest, this, null, 0, 0);
|
||||
Database.SaveQuest(this, questScenario[i]);
|
||||
SendQuestClientUpdate(i);
|
||||
break;
|
||||
|
@ -1598,6 +1649,16 @@ namespace Meteor.Map.Actors
|
|||
|
||||
return null;
|
||||
}
|
||||
public Quest GetQuestGuildleve(uint id)
|
||||
{
|
||||
for (int i = 0; i < questGuildleve.Length; i++)
|
||||
{
|
||||
if (questGuildleve[i] != null && questGuildleve[i].actorId == (0xA0F00000 | id))
|
||||
return questGuildleve[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool HasQuest(string name)
|
||||
{
|
||||
|
@ -1621,6 +1682,17 @@ namespace Meteor.Map.Actors
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool HasQuestGuildleve(uint id)
|
||||
{
|
||||
for (int i = 0; i < questGuildleve.Length; i++)
|
||||
{
|
||||
if (questGuildleve[i] != null && questGuildleve[i].actorId == (0xA0F00000 | id))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasGuildleve(uint id)
|
||||
{
|
||||
for (int i = 0; i < work.guildleveId.Length; i++)
|
||||
|
@ -1643,6 +1715,17 @@ namespace Meteor.Map.Actors
|
|||
return -1;
|
||||
}
|
||||
|
||||
public int GetQuestGuildleveSlot(uint id)
|
||||
{
|
||||
for (int i = 0; i < questGuildleve.Length; i++)
|
||||
{
|
||||
if (questGuildleve[i] != null && questGuildleve[i].actorId == (0xA0F00000 | id))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void SetNpcLS(uint npcLSId, uint state)
|
||||
{
|
||||
bool isCalling, isExtra;
|
||||
|
@ -1679,30 +1762,36 @@ namespace Meteor.Map.Actors
|
|||
Database.SaveNpcLS(this, npcLSId, isCalling, isExtra);
|
||||
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("playerWork/npcLinkshellChat", this);
|
||||
propPacketUtil.AddProperty(String.Format("playerWork.npcLinkshellChatExtra[{0}]", npcLSId));
|
||||
propPacketUtil.AddProperty(String.Format("playerWork.npcLinkshellChatCalling[{0}]", npcLSId));
|
||||
propPacketUtil.AddProperty(string.Format("playerWork.npcLinkshellChatExtra[{0}]", npcLSId));
|
||||
propPacketUtil.AddProperty(string.Format("playerWork.npcLinkshellChatCalling[{0}]", npcLSId));
|
||||
QueuePackets(propPacketUtil.Done());
|
||||
}
|
||||
|
||||
private void SendQuestClientUpdate(int slot)
|
||||
{
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("playerWork/journal", this);
|
||||
propPacketUtil.AddProperty(String.Format("playerWork.questScenario[{0}]", slot));
|
||||
propPacketUtil.AddProperty(string.Format("playerWork.questScenario[{0}]", slot));
|
||||
QueuePackets(propPacketUtil.Done());
|
||||
}
|
||||
private void SendQuestGuildleveClientUpdate(int slot)
|
||||
{
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("playerWork/journal", this);
|
||||
propPacketUtil.AddProperty(string.Format("playerWork.questGuildleve[{0}]", slot));
|
||||
QueuePackets(propPacketUtil.Done());
|
||||
}
|
||||
|
||||
private void SendGuildleveClientUpdate(int slot)
|
||||
{
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("work/guildleve", this);
|
||||
propPacketUtil.AddProperty(String.Format("work.guildleveId[{0}]", slot));
|
||||
propPacketUtil.AddProperty(string.Format("work.guildleveId[{0}]", slot));
|
||||
QueuePackets(propPacketUtil.Done());
|
||||
}
|
||||
|
||||
private void SendGuildleveMarkClientUpdate(int slot)
|
||||
{
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("work/guildleve", this);
|
||||
propPacketUtil.AddProperty(String.Format("work.guildleveDone[{0}]", slot));
|
||||
propPacketUtil.AddProperty(String.Format("work.guildleveChecked[{0}]", slot));
|
||||
propPacketUtil.AddProperty(string.Format("work.guildleveDone[{0}]", slot));
|
||||
propPacketUtil.AddProperty(string.Format("work.guildleveChecked[{0}]", slot));
|
||||
QueuePackets(propPacketUtil.Done());
|
||||
}
|
||||
|
||||
|
@ -2034,10 +2123,35 @@ namespace Meteor.Map.Actors
|
|||
retainerMeetingGroup = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(DateTime tick)
|
||||
|
||||
public void AddRecentRecipe(Recipe recipe)
|
||||
{
|
||||
|
||||
recentRecipes.Remove(recipe);
|
||||
if (recentRecipes.Count > 8)
|
||||
recentRecipes.RemoveAt(7);
|
||||
recentRecipes.Add(recipe);
|
||||
}
|
||||
|
||||
public List<Recipe> GetRecentRecipes()
|
||||
{
|
||||
return recentRecipes;
|
||||
}
|
||||
|
||||
public void AddAwardedRecipe(Recipe recipe)
|
||||
{
|
||||
awardedRecipes.Remove(recipe);
|
||||
if (awardedRecipes.Count > 8)
|
||||
awardedRecipes.RemoveAt(7);
|
||||
awardedRecipes.Add(recipe);
|
||||
}
|
||||
|
||||
public List<Recipe> GetAwardedRecipes()
|
||||
{
|
||||
return awardedRecipes;
|
||||
}
|
||||
|
||||
public override void Update(DateTime tick)
|
||||
{
|
||||
// Chocobo Rental Expirey
|
||||
if (rentalExpireTime != 0)
|
||||
{
|
||||
|
@ -2048,7 +2162,7 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
rentalExpireTime = 0;
|
||||
rentalMinLeft = 0;
|
||||
ChangeMusic(GetZone().bgmDay);
|
||||
ResetMusic();
|
||||
SetMountState(0);
|
||||
ChangeSpeed(0.0f, 2.0f, 5.0f, 5.0f);
|
||||
ChangeState(0);
|
||||
|
@ -2102,7 +2216,7 @@ namespace Meteor.Map.Actors
|
|||
if (GetMod(i) != charaWork.battleTemp.generalParameter[i])
|
||||
{
|
||||
charaWork.battleTemp.generalParameter[i] = (short)GetMod(i);
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.battleTemp.generalParameter[{0}]", i));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.battleTemp.generalParameter[{0}]", i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2149,8 +2263,8 @@ namespace Meteor.Map.Actors
|
|||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("charaWork/command", this);
|
||||
foreach (ushort slot in slotsToUpdate)
|
||||
{
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.command[{0}]", slot));
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.commandCategory[{0}]", slot));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.command[{0}]", slot));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.commandCategory[{0}]", slot));
|
||||
}
|
||||
|
||||
propPacketUtil.NewTarget("charaWork/commandDetailForSelf");
|
||||
|
@ -2158,7 +2272,7 @@ namespace Meteor.Map.Actors
|
|||
foreach (ushort slot in slotsToUpdate)
|
||||
{
|
||||
charaWork.parameterSave.commandSlot_compatibility[slot - charaWork.commandBorder] = charaWork.command[slot] != 0;
|
||||
propPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_compatibility[{0}]", slot - charaWork.commandBorder));
|
||||
propPacketUtil.AddProperty(string.Format("charaWork.parameterSave.commandSlot_compatibility[{0}]", slot - charaWork.commandBorder));
|
||||
}
|
||||
|
||||
QueuePackets(propPacketUtil.Done());
|
||||
|
@ -2172,8 +2286,8 @@ namespace Meteor.Map.Actors
|
|||
|
||||
foreach (ushort slot in slotsToUpdate)
|
||||
{
|
||||
recastPacketUtil.AddProperty(String.Format("charaWork.parameterTemp.maxCommandRecastTime[{0}]", slot - charaWork.commandBorder));
|
||||
recastPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", slot - charaWork.commandBorder));
|
||||
recastPacketUtil.AddProperty(string.Format("charaWork.parameterTemp.maxCommandRecastTime[{0}]", slot - charaWork.commandBorder));
|
||||
recastPacketUtil.AddProperty(string.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", slot - charaWork.commandBorder));
|
||||
}
|
||||
|
||||
QueuePackets(recastPacketUtil.Done());
|
||||
|
@ -2595,7 +2709,7 @@ namespace Meteor.Map.Actors
|
|||
charaWork.battleSave.skillPoint[classId - 1] = 0;
|
||||
//send new level
|
||||
ActorPropertyPacketUtil levelPropertyPacket = new ActorPropertyPacketUtil("charaWork/stateForAll", this);
|
||||
levelPropertyPacket.AddProperty(String.Format("charaWork.battleSave.skillLevel[{0}]", classId - 1));
|
||||
levelPropertyPacket.AddProperty(string.Format("charaWork.battleSave.skillLevel[{0}]", classId - 1));
|
||||
levelPropertyPacket.AddProperty("charaWork.parameterSave.state_mainSkillLevel");
|
||||
QueuePackets(levelPropertyPacket.Done());
|
||||
|
||||
|
@ -2606,7 +2720,7 @@ namespace Meteor.Map.Actors
|
|||
charaWork.battleSave.skillPoint[classId - 1] = Math.Min(charaWork.battleSave.skillPoint[classId - 1] + exp, MAXEXP[GetLevel() - 1]);
|
||||
|
||||
ActorPropertyPacketUtil expPropertyPacket = new ActorPropertyPacketUtil("charaWork/battleStateForSelf", this);
|
||||
expPropertyPacket.AddProperty(String.Format("charaWork.battleSave.skillPoint[{0}]", classId - 1));
|
||||
expPropertyPacket.AddProperty(string.Format("charaWork.battleSave.skillPoint[{0}]", classId - 1));
|
||||
|
||||
QueuePackets(expPropertyPacket.Done());
|
||||
Database.SetExp(this, classId, charaWork.battleSave.skillPoint[classId - 1]);
|
||||
|
|
|
@ -239,7 +239,7 @@ namespace Meteor.Map.actors.director
|
|||
//Format Class Name
|
||||
string className = this.className;
|
||||
|
||||
className = Char.ToLowerInvariant(className[0]) + className.Substring(1);
|
||||
className = char.ToLowerInvariant(className[0]) + className.Substring(1);
|
||||
|
||||
//Format Zone Name
|
||||
string zoneName = zone.zoneName.Replace("Field", "Fld")
|
||||
|
@ -255,7 +255,7 @@ namespace Meteor.Map.actors.director
|
|||
//Check if "normal"
|
||||
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
|
||||
{
|
||||
|
@ -273,7 +273,7 @@ namespace Meteor.Map.actors.director
|
|||
if (zone is PrivateArea)
|
||||
privLevel = ((PrivateArea)zone).GetPrivateAreaType();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public string GetScriptPath()
|
||||
|
@ -283,7 +283,7 @@ namespace Meteor.Map.actors.director
|
|||
|
||||
private void LoadLuaScript()
|
||||
{
|
||||
string luaPath = String.Format(LuaEngine.FILEPATH_DIRECTORS, GetScriptPath());
|
||||
string luaPath = string.Format(LuaEngine.FILEPATH_DIRECTORS, GetScriptPath());
|
||||
directorScript = LuaEngine.LoadScript(luaPath);
|
||||
if (directorScript == null)
|
||||
Program.Log.Error("Could not find script for director {0}.", GetName());
|
||||
|
@ -293,7 +293,7 @@ namespace Meteor.Map.actors.director
|
|||
{
|
||||
if (directorScript != null)
|
||||
{
|
||||
directorScript = LuaEngine.LoadScript(String.Format(LuaEngine.FILEPATH_DIRECTORS, directorScriptPath));
|
||||
directorScript = LuaEngine.LoadScript(string.Format(LuaEngine.FILEPATH_DIRECTORS, directorScriptPath));
|
||||
if (!directorScript.Globals.Get(funcName).IsNil())
|
||||
{
|
||||
DynValue result = directorScript.Call(directorScript.Globals[funcName], args);
|
||||
|
|
|
@ -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 = zone.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.ResetMusic();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ namespace Meteor.Map.actors.director
|
|||
{
|
||||
guildleveWork.aimNumNow[index] = value;
|
||||
ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("guildleveWork/infoVariable", this);
|
||||
propertyBuilder.AddProperty(String.Format("guildleveWork.aimNumNow[{0}]", index));
|
||||
propertyBuilder.AddProperty(string.Format("guildleveWork.aimNumNow[{0}]", index));
|
||||
SendPacketsToPlayers(propertyBuilder.Done());
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ namespace Meteor.Map.actors.director
|
|||
{
|
||||
guildleveWork.uiState[index] = value;
|
||||
ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("guildleveWork/infoVariable", this);
|
||||
propertyBuilder.AddProperty(String.Format("guildleveWork.uiState[{0}]", index));
|
||||
propertyBuilder.AddProperty(string.Format("guildleveWork.uiState[{0}]", index));
|
||||
SendPacketsToPlayers(propertyBuilder.Done());
|
||||
}
|
||||
|
||||
|
@ -228,9 +228,9 @@ namespace Meteor.Map.actors.director
|
|||
guildleveWork.markerY[markerIndex] = y;
|
||||
guildleveWork.markerZ[markerIndex] = z;
|
||||
ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("guildleveWork/marker", this);
|
||||
propertyBuilder.AddProperty(String.Format("guildleveWork.markerX[{0}]", markerIndex));
|
||||
propertyBuilder.AddProperty(String.Format("guildleveWork.markerY[{0}]", markerIndex));
|
||||
propertyBuilder.AddProperty(String.Format("guildleveWork.markerZ[{0}]", markerIndex));
|
||||
propertyBuilder.AddProperty(string.Format("guildleveWork.markerX[{0}]", markerIndex));
|
||||
propertyBuilder.AddProperty(string.Format("guildleveWork.markerY[{0}]", markerIndex));
|
||||
propertyBuilder.AddProperty(string.Format("guildleveWork.markerZ[{0}]", markerIndex));
|
||||
SendPacketsToPlayers(propertyBuilder.Done());
|
||||
}
|
||||
|
||||
|
|
139
Map Server/Actors/Quest/PassiveGuildleve.cs
Normal file
139
Map Server/Actors/Quest/PassiveGuildleve.cs
Normal file
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
using Meteor.Map.dataobjects;
|
||||
using Meteor.Map.DataObjects;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Meteor.Map.Actors
|
||||
{
|
||||
class PassiveGuildleve : Quest
|
||||
{
|
||||
private Recipe targetRecipe;
|
||||
|
||||
private byte currentDifficulty;
|
||||
private short numSuccesses;
|
||||
private short currentAttempt;
|
||||
|
||||
private bool hasMaterials;
|
||||
|
||||
private PassiveGuildleveData passiveGLData;
|
||||
|
||||
public PassiveGuildleve(Quest staticQuest, Player owner, byte currentDifficulty)
|
||||
: base(staticQuest, owner)
|
||||
{
|
||||
passiveGLData = Server.GetPassiveGLGamedata(GetQuestId());
|
||||
targetRecipe = Server.ResolveRecipe().GetRecipeByItemID(passiveGLData.objectiveItemId[currentDifficulty]);
|
||||
this.currentDifficulty = currentDifficulty;
|
||||
currentAttempt = 0;
|
||||
numSuccesses = 0;
|
||||
hasMaterials = false;
|
||||
}
|
||||
|
||||
public PassiveGuildleve(Quest staticQuest, Player owner, string questDataJson) : base(staticQuest, owner)
|
||||
{
|
||||
passiveGLData = Server.GetPassiveGLGamedata(GetQuestId());
|
||||
|
||||
Dictionary<string, object> questData = null;
|
||||
|
||||
if (questDataJson != null)
|
||||
questData = JsonConvert.DeserializeObject<Dictionary<string, object>>(questDataJson);
|
||||
|
||||
if (questData == null)
|
||||
questData = new Dictionary<string, object>();
|
||||
|
||||
currentDifficulty = questData.ContainsKey("currentDifficulty") ? (byte)questData["currentDifficulty"] : (byte)0;
|
||||
currentAttempt = questData.ContainsKey("currentAttempt") ? (short)questData["currentAttempt"] : (short)0;
|
||||
numSuccesses = questData.ContainsKey("numSuccesses") ? (short)questData["numSuccesses"] : (short)0;
|
||||
hasMaterials = questData.ContainsKey("hasMaterials") ? (bool)questData["hasMaterials"] : false;
|
||||
|
||||
targetRecipe = Server.ResolveRecipe().GetRecipeByItemID(passiveGLData.objectiveItemId[currentDifficulty]);
|
||||
}
|
||||
|
||||
public void CraftSuccess()
|
||||
{
|
||||
numSuccesses++;
|
||||
currentAttempt++;
|
||||
}
|
||||
|
||||
public void CraftFail()
|
||||
{
|
||||
currentAttempt++;
|
||||
}
|
||||
|
||||
public Recipe GetRecipe()
|
||||
{
|
||||
return targetRecipe;
|
||||
}
|
||||
|
||||
public int GetNumberOfSuccesses()
|
||||
{
|
||||
return numSuccesses;
|
||||
}
|
||||
|
||||
public int GetRemainingMaterials()
|
||||
{
|
||||
return passiveGLData.numberOfAttempts[currentDifficulty] - currentAttempt;
|
||||
}
|
||||
public int GetCurrentAttempt()
|
||||
{
|
||||
return currentAttempt;
|
||||
}
|
||||
|
||||
public int GetMaxAttempts()
|
||||
{
|
||||
return passiveGLData.numberOfAttempts[currentDifficulty];
|
||||
}
|
||||
|
||||
public byte GetCurrentDifficulty()
|
||||
{
|
||||
return currentDifficulty;
|
||||
}
|
||||
|
||||
public bool HasMaterials()
|
||||
{
|
||||
return hasMaterials;
|
||||
}
|
||||
|
||||
public PassiveGuildleveData GetPassiveGLData()
|
||||
{
|
||||
return passiveGLData;
|
||||
}
|
||||
|
||||
public override void SaveData()
|
||||
{
|
||||
Database.SaveQuest(owner, this);
|
||||
}
|
||||
|
||||
public override string GetSerializedQuestData()
|
||||
{
|
||||
Dictionary<string, object> questData = new Dictionary<string, object>
|
||||
{
|
||||
{ "currentDifficulty", currentDifficulty },
|
||||
{ "currentAttempt", currentAttempt },
|
||||
{ "itemsCompleted", numSuccesses },
|
||||
{ "hasMaterials", hasMaterials }
|
||||
};
|
||||
return JsonConvert.SerializeObject(questData, Formatting.Indented);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
|||
*/
|
||||
|
||||
using Meteor.Map.lua;
|
||||
using MySql.Data.MySqlClient;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -28,40 +29,18 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
class Quest : Actor
|
||||
{
|
||||
private Player owner;
|
||||
private uint currentPhase = 0;
|
||||
private uint questFlags = 0;
|
||||
private Dictionary<string, Object> questData = new Dictionary<string, object>();
|
||||
protected Player owner;
|
||||
|
||||
public Quest(uint actorID, string name)
|
||||
: base(actorID)
|
||||
{
|
||||
actorName = name;
|
||||
actorName = name;
|
||||
}
|
||||
|
||||
public Quest(Player owner, uint actorID, string name, string questDataJson, uint questFlags, uint currentPhase)
|
||||
: base(actorID)
|
||||
public Quest(Quest staticQuest, Player owner) : base(staticQuest.actorId)
|
||||
{
|
||||
this.owner = owner;
|
||||
actorName = name;
|
||||
this.questFlags = questFlags;
|
||||
|
||||
if (questDataJson != null)
|
||||
this.questData = JsonConvert.DeserializeObject<Dictionary<string, Object>>(questDataJson);
|
||||
else
|
||||
questData = null;
|
||||
|
||||
if (questData == null)
|
||||
questData = new Dictionary<string, object>();
|
||||
|
||||
this.currentPhase = currentPhase;
|
||||
}
|
||||
|
||||
public void SetQuestData(string dataName, object data)
|
||||
{
|
||||
questData[dataName] = data;
|
||||
|
||||
//Inform update
|
||||
actorName = staticQuest.actorName;
|
||||
}
|
||||
|
||||
public uint GetQuestId()
|
||||
|
@ -69,81 +48,8 @@ namespace Meteor.Map.Actors
|
|||
return actorId & 0xFFFFF;
|
||||
}
|
||||
|
||||
public object GetQuestData(string dataName)
|
||||
{
|
||||
if (questData.ContainsKey(dataName))
|
||||
return questData[dataName];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ClearQuestData()
|
||||
{
|
||||
questData.Clear();
|
||||
}
|
||||
|
||||
public void ClearQuestFlags()
|
||||
{
|
||||
questFlags = 0;
|
||||
}
|
||||
|
||||
public void SetQuestFlag(int bitIndex, bool value)
|
||||
{
|
||||
if (bitIndex >= 32)
|
||||
{
|
||||
Program.Log.Error("Tried to access bit flag >= 32 for questId: {0}", actorId);
|
||||
return;
|
||||
}
|
||||
|
||||
int mask = 1 << bitIndex;
|
||||
|
||||
if (value)
|
||||
questFlags |= (uint)(1 << bitIndex);
|
||||
else
|
||||
questFlags &= (uint)~(1 << bitIndex);
|
||||
|
||||
DoCompletionCheck();
|
||||
}
|
||||
|
||||
public bool GetQuestFlag(int bitIndex)
|
||||
{
|
||||
if (bitIndex >= 32)
|
||||
{
|
||||
Program.Log.Error("Tried to access bit flag >= 32 for questId: {0}", actorId);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return (questFlags & (1 << bitIndex)) == (1 << bitIndex);
|
||||
}
|
||||
|
||||
public uint GetPhase()
|
||||
{
|
||||
return currentPhase;
|
||||
}
|
||||
|
||||
public void NextPhase(uint phaseNumber)
|
||||
{
|
||||
currentPhase = phaseNumber;
|
||||
owner.SendGameMessage(Server.GetWorldManager().GetActor(), 25116, 0x20, (object)GetQuestId());
|
||||
SaveData();
|
||||
|
||||
DoCompletionCheck();
|
||||
}
|
||||
|
||||
public uint GetQuestFlags()
|
||||
{
|
||||
return questFlags;
|
||||
}
|
||||
|
||||
public string GetSerializedQuestData()
|
||||
{
|
||||
return JsonConvert.SerializeObject(questData, Formatting.Indented);
|
||||
}
|
||||
|
||||
public void SaveData()
|
||||
{
|
||||
Database.SaveQuest(owner, this);
|
||||
}
|
||||
public virtual void SaveData() { }
|
||||
public virtual string GetSerializedQuestData() { return null; }
|
||||
|
||||
public void DoCompletionCheck()
|
||||
{
|
||||
|
@ -161,5 +67,45 @@ namespace Meteor.Map.Actors
|
|||
owner.SendGameMessage(owner, Server.GetWorldManager().GetActor(), 25236, 0x20, (object)GetQuestId());
|
||||
}
|
||||
|
||||
public static Quest LoadQuestDB(Player player, MySqlDataReader reader)
|
||||
{
|
||||
uint questID = 0xA0F00000 | reader.GetUInt32("questId");
|
||||
Quest staticQuest = Server.GetStaticActors(questID) as Quest;
|
||||
string questData = null;
|
||||
|
||||
if (!reader.IsDBNull(reader.GetOrdinal("questData")))
|
||||
questData = reader.GetString("questData");
|
||||
else
|
||||
questData = "{}";
|
||||
|
||||
if (staticQuest.IsScenario())
|
||||
{
|
||||
uint questFlags = 0;
|
||||
uint currentPhase = 0;
|
||||
|
||||
if (!reader.IsDBNull(reader.GetOrdinal("questFlags")))
|
||||
questFlags = reader.GetUInt32("questFlags");
|
||||
|
||||
if (!reader.IsDBNull(reader.GetOrdinal("currentPhase")))
|
||||
currentPhase = reader.GetUInt32("currentPhase");
|
||||
|
||||
return new Scenario(staticQuest, player, questData, questFlags, currentPhase);
|
||||
}
|
||||
else if (staticQuest.IsCraftPassiveGuildleve())
|
||||
{
|
||||
return new PassiveGuildleve(staticQuest, player, questData);
|
||||
}
|
||||
throw new NotImplementedException("Unknown quest type added");
|
||||
}
|
||||
|
||||
public bool IsScenario()
|
||||
{
|
||||
return !IsCraftPassiveGuildleve();
|
||||
}
|
||||
|
||||
public bool IsCraftPassiveGuildleve()
|
||||
{
|
||||
return GetQuestId() > 120000 && GetQuestId() < 121024;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
140
Map Server/Actors/Quest/Scenario.cs
Normal file
140
Map Server/Actors/Quest/Scenario.cs
Normal file
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
using Meteor.Map.lua;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Meteor.Map.Actors
|
||||
{
|
||||
class Scenario : Quest
|
||||
{
|
||||
private uint currentPhase = 0;
|
||||
private uint questFlags = 0;
|
||||
private Dictionary<string, object> questData = new Dictionary<string, object>();
|
||||
|
||||
public Scenario(uint actorID, string name)
|
||||
: base(actorID, name)
|
||||
{
|
||||
actorName = name;
|
||||
}
|
||||
|
||||
public Scenario(Quest staticQuest, Player owner, string questDataJson, uint questFlags, uint currentPhase)
|
||||
: base(staticQuest, owner)
|
||||
{
|
||||
this.questFlags = questFlags;
|
||||
|
||||
if (questDataJson != null)
|
||||
this.questData = JsonConvert.DeserializeObject<Dictionary<string, object>>(questDataJson);
|
||||
else
|
||||
questData = null;
|
||||
|
||||
if (questData == null)
|
||||
questData = new Dictionary<string, object>();
|
||||
|
||||
this.currentPhase = currentPhase;
|
||||
}
|
||||
|
||||
public void SetQuestData(string dataName, object data)
|
||||
{
|
||||
questData[dataName] = data;
|
||||
|
||||
//Inform update
|
||||
}
|
||||
|
||||
public object GetQuestData(string dataName)
|
||||
{
|
||||
if (questData.ContainsKey(dataName))
|
||||
return questData[dataName];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ClearQuestData()
|
||||
{
|
||||
questData.Clear();
|
||||
}
|
||||
|
||||
public void ClearQuestFlags()
|
||||
{
|
||||
questFlags = 0;
|
||||
}
|
||||
|
||||
public void SetQuestFlag(int bitIndex, bool value)
|
||||
{
|
||||
if (bitIndex >= 32)
|
||||
{
|
||||
Program.Log.Error("Tried to access bit flag >= 32 for questId: {0}", actorId);
|
||||
return;
|
||||
}
|
||||
|
||||
int mask = 1 << bitIndex;
|
||||
|
||||
if (value)
|
||||
questFlags |= (uint)(1 << bitIndex);
|
||||
else
|
||||
questFlags &= (uint)~(1 << bitIndex);
|
||||
|
||||
DoCompletionCheck();
|
||||
}
|
||||
|
||||
public bool GetQuestFlag(int bitIndex)
|
||||
{
|
||||
if (bitIndex >= 32)
|
||||
{
|
||||
Program.Log.Error("Tried to access bit flag >= 32 for questId: {0}", actorId);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return (questFlags & (1 << bitIndex)) == (1 << bitIndex);
|
||||
}
|
||||
|
||||
public uint GetPhase()
|
||||
{
|
||||
return currentPhase;
|
||||
}
|
||||
|
||||
public void NextPhase(uint phaseNumber)
|
||||
{
|
||||
currentPhase = phaseNumber;
|
||||
owner.SendGameMessage(Server.GetWorldManager().GetActor(), 25116, 0x20, (object)GetQuestId());
|
||||
SaveData();
|
||||
|
||||
DoCompletionCheck();
|
||||
}
|
||||
|
||||
public uint GetQuestFlags()
|
||||
{
|
||||
return questFlags;
|
||||
}
|
||||
|
||||
public override string GetSerializedQuestData()
|
||||
{
|
||||
return JsonConvert.SerializeObject(questData, Formatting.Indented);
|
||||
}
|
||||
|
||||
public override void SaveData()
|
||||
{
|
||||
Database.SaveQuest(owner, this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -59,8 +59,8 @@ namespace Meteor.Map.Actors
|
|||
try
|
||||
{
|
||||
byte byteIn = binReader.ReadByte();
|
||||
byte byteOut = (Byte)(byteIn ^ 0x73);
|
||||
binWriter.Write((Byte)byteOut);
|
||||
byte byteOut = (byte)(byteIn ^ 0x73);
|
||||
binWriter.Write((byte)byteOut);
|
||||
}
|
||||
catch (EndOfStreamException) { break; }
|
||||
}
|
||||
|
|
92
Map Server/DataObjects/PassiveGuildleveData.cs
Normal file
92
Map Server/DataObjects/PassiveGuildleveData.cs
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
namespace Meteor.Map.dataobjects
|
||||
{
|
||||
class PassiveGuildleveData
|
||||
{
|
||||
public readonly uint id;
|
||||
public readonly uint plateId;
|
||||
public readonly uint borderId;
|
||||
public readonly uint recommendedClass;
|
||||
public readonly uint issuingLocation;
|
||||
public readonly uint leveLocation;
|
||||
public readonly uint deliveryDisplayName;
|
||||
|
||||
public readonly int[] objectiveItemId;
|
||||
public readonly int[] objectiveQuantity;
|
||||
public readonly int[] rewardItemId;
|
||||
public readonly int[] rewardQuantity;
|
||||
public readonly int[] numberOfAttempts;
|
||||
public readonly int[] recommendedLevel;
|
||||
|
||||
public PassiveGuildleveData(MySqlDataReader reader)
|
||||
{
|
||||
id = reader.GetUInt32("id");
|
||||
plateId = reader.GetUInt32("plateId");
|
||||
borderId = reader.GetUInt32("borderId");
|
||||
recommendedClass = reader.GetUInt32("recommendedClass");
|
||||
issuingLocation = reader.GetUInt32("issuingLocation");
|
||||
leveLocation = reader.GetUInt32("guildleveLocation");
|
||||
deliveryDisplayName = reader.GetUInt32("deliveryDisplayName");
|
||||
|
||||
objectiveItemId = new int[4];
|
||||
objectiveQuantity = new int[4];
|
||||
rewardItemId = new int[4];
|
||||
rewardQuantity = new int[4];
|
||||
numberOfAttempts = new int[4];
|
||||
recommendedLevel = new int[4];
|
||||
|
||||
objectiveItemId[0] = reader.GetInt32("objectiveItemId1");
|
||||
objectiveItemId[1] = reader.GetInt32("objectiveItemId2");
|
||||
objectiveItemId[2] = reader.GetInt32("objectiveItemId3");
|
||||
objectiveItemId[3] = reader.GetInt32("objectiveItemId4");;
|
||||
|
||||
objectiveQuantity[0] = reader.GetInt32("objectiveQuantity1");
|
||||
objectiveQuantity[1] = reader.GetInt32("objectiveQuantity2");
|
||||
objectiveQuantity[2] = reader.GetInt32("objectiveQuantity3");
|
||||
objectiveQuantity[3] = reader.GetInt32("objectiveQuantity4");
|
||||
|
||||
rewardItemId[0] = reader.GetInt32("rewardItemId1");
|
||||
rewardItemId[1] = reader.GetInt32("rewardItemId2");
|
||||
rewardItemId[2] = reader.GetInt32("rewardItemId3");
|
||||
rewardItemId[3] = reader.GetInt32("rewardItemId4");
|
||||
|
||||
rewardQuantity[0] = reader.GetInt32("rewardQuantity1");
|
||||
rewardQuantity[1] = reader.GetInt32("rewardQuantity2");
|
||||
rewardQuantity[2] = reader.GetInt32("rewardQuantity3");
|
||||
rewardQuantity[3] = reader.GetInt32("rewardQuantity4");
|
||||
|
||||
numberOfAttempts[0] = reader.GetInt32("numberOfAttempts1");
|
||||
numberOfAttempts[1] = reader.GetInt32("numberOfAttempts2");
|
||||
numberOfAttempts[2] = reader.GetInt32("numberOfAttempts3");
|
||||
numberOfAttempts[3] = reader.GetInt32("numberOfAttempts4");
|
||||
|
||||
recommendedLevel[0] = reader.GetInt32("recommendedLevel1");
|
||||
recommendedLevel[1] = reader.GetInt32("recommendedLevel2");
|
||||
recommendedLevel[2] = reader.GetInt32("recommendedLevel3");
|
||||
recommendedLevel[3] = reader.GetInt32("recommendedLevel4");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -8,16 +8,28 @@ namespace Meteor.Map.DataObjects
|
|||
{
|
||||
class Recipe
|
||||
{
|
||||
public readonly uint id;
|
||||
public readonly uint resultItemID;
|
||||
public readonly uint resultQuantity;
|
||||
public readonly uint[] materials;
|
||||
public readonly byte[] allowedCrafters;
|
||||
public readonly uint crystalId1;
|
||||
public readonly uint crystalId2;
|
||||
public readonly uint crystalQuantity1;
|
||||
public readonly uint crystalQuantity2;
|
||||
public readonly byte tier;
|
||||
|
||||
public Recipe(uint resultItemID, uint resultQuantity, byte[] allowedCrafters, byte tier)
|
||||
public Recipe(uint id, uint resultItemID, uint resultQuantity, uint[] materials, uint crystalId1, uint crystalQuantity1, uint crystalId2, uint crystalQuantity2, byte[] allowedCrafters, byte tier)
|
||||
{
|
||||
this.id = id;
|
||||
this.resultItemID = resultItemID;
|
||||
this.resultQuantity = resultQuantity;
|
||||
this.materials = materials;
|
||||
this.allowedCrafters = allowedCrafters;
|
||||
this.crystalId1 = crystalId1;
|
||||
this.crystalId2 = crystalId2;
|
||||
this.crystalQuantity1 = crystalQuantity1;
|
||||
this.crystalQuantity2 = crystalQuantity2;
|
||||
this.tier = tier;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Linq;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Meteor.Map.DataObjects
|
||||
{
|
||||
|
@ -37,8 +39,6 @@ namespace Meteor.Map.DataObjects
|
|||
mats[6] = mat7;
|
||||
mats[7] = mat8;
|
||||
|
||||
Array.Sort(mats);
|
||||
|
||||
byte[] result = new byte[8 * sizeof(int)];
|
||||
Buffer.BlockCopy(mats, 0, result, 0, result.Length);
|
||||
string hash;
|
||||
|
@ -53,8 +53,33 @@ namespace Meteor.Map.DataObjects
|
|||
return null;
|
||||
}
|
||||
|
||||
public Recipe GetMatsForRecipe(uint recipeID)
|
||||
public Recipe GetRecipeByItemID(int objectiveItemID)
|
||||
{
|
||||
return recipeList.Where(recipe => recipe.Value.resultItemID == objectiveItemID).FirstOrDefault().Value;
|
||||
}
|
||||
|
||||
public DynValue RecipesToItemIdTable(List<Recipe> recipeList)
|
||||
{
|
||||
DynValue[] itemIDs = new DynValue[8];
|
||||
for (int i = 0; i < 8; i++)
|
||||
itemIDs[i] = recipeList != null && i < recipeList.Count ? DynValue.NewNumber(recipeList[i].resultItemID) : DynValue.NewNil();
|
||||
|
||||
return DynValue.NewTable(new Table(new Script(), itemIDs));
|
||||
}
|
||||
public DynValue RecipeToMatIdTable(Recipe recipe)
|
||||
{
|
||||
DynValue[] itemIDs = new DynValue[8];
|
||||
for (int i = 0; i < 8; i++)
|
||||
itemIDs[i] = DynValue.NewNumber(recipe.materials[i]);
|
||||
|
||||
return DynValue.NewTable(new Table(new Script(), itemIDs));
|
||||
}
|
||||
|
||||
public Recipe GetRecipeByID(uint recipeID)
|
||||
{
|
||||
if (recipeID == 0)
|
||||
return null;
|
||||
|
||||
if (recipeList.ContainsKey(recipeID))
|
||||
return recipeList[recipeID];
|
||||
else
|
||||
|
|
|
@ -42,10 +42,10 @@ namespace Meteor.Map
|
|||
class Database
|
||||
{
|
||||
|
||||
public static uint GetUserIdFromSession(String sessionId)
|
||||
public static uint GetUserIdFromSession(string sessionId)
|
||||
{
|
||||
uint id = 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)))
|
||||
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
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ namespace Meteor.Map
|
|||
|
||||
public static Dictionary<uint, ItemData> GetItemGamedata()
|
||||
{
|
||||
using (var 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)))
|
||||
using (var 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)))
|
||||
{
|
||||
Dictionary<uint, ItemData> gamedataItems = new Dictionary<uint, ItemData>();
|
||||
|
||||
|
@ -131,7 +131,7 @@ namespace Meteor.Map
|
|||
|
||||
public static Dictionary<uint, GuildleveData> GetGuildleveGamedata()
|
||||
{
|
||||
using (var 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)))
|
||||
using (var 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)))
|
||||
{
|
||||
Dictionary<uint, GuildleveData> gamedataGuildleves = new Dictionary<uint, GuildleveData>();
|
||||
|
||||
|
@ -151,7 +151,6 @@ namespace Meteor.Map
|
|||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
uint id = reader.GetUInt32("id");
|
||||
GuildleveData guildleve = new GuildleveData(reader);
|
||||
gamedataGuildleves.Add(guildleve.id, guildleve);
|
||||
}
|
||||
|
@ -170,9 +169,49 @@ namespace Meteor.Map
|
|||
}
|
||||
}
|
||||
|
||||
public static Dictionary<uint, PassiveGuildleveData> GetPassiveGuildleveGamedata()
|
||||
{
|
||||
using (var 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)))
|
||||
{
|
||||
Dictionary<uint, PassiveGuildleveData> gamedataPassiveGuildleves = new Dictionary<uint, PassiveGuildleveData>();
|
||||
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
string query = @"
|
||||
SELECT
|
||||
*
|
||||
FROM gamedata_passivegl_craft
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
PassiveGuildleveData passiveGL = new PassiveGuildleveData(reader);
|
||||
gamedataPassiveGuildleves.Add(passiveGL.id, passiveGL);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
|
||||
return gamedataPassiveGuildleves;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool GetRecipeGamedata(Dictionary<uint, Recipe> recipeList, Dictionary<string, List<Recipe>> matToRecipe)
|
||||
{
|
||||
using (var 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)))
|
||||
using (var 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
|
||||
{
|
||||
|
@ -227,10 +266,6 @@ namespace Meteor.Map
|
|||
mats[6] = reader.GetUInt32("material6");
|
||||
mats[7] = reader.GetUInt32("material7");
|
||||
|
||||
Array.Sort(mats);
|
||||
|
||||
Recipe recipe = new Recipe(craftedItem, craftedQuantity, new byte[] { }, 1);
|
||||
|
||||
//Hash for the Mat -> Recipe Dictionary
|
||||
byte[] result = new byte[8 * sizeof(int)];
|
||||
Buffer.BlockCopy(mats, 0, result, 0, result.Length);
|
||||
|
@ -243,9 +278,12 @@ namespace Meteor.Map
|
|||
if (!matToRecipe.ContainsKey(hash))
|
||||
matToRecipe.Add(hash, new List<Recipe>());
|
||||
|
||||
//Create obj
|
||||
Recipe recipe = new Recipe(recipeID, craftedItem, craftedQuantity, mats, crystal0ID, crystal0Quantity, crystal1ID, crystal1Quantity, new byte[] { }, 1);
|
||||
|
||||
//Add to both Dictionaries
|
||||
recipeList.Add(recipeID, new Recipe(craftedItem, craftedQuantity, new byte[] { }, 1));
|
||||
matToRecipe[hash].Add(new Recipe(craftedItem, craftedQuantity, new byte[] { }, 1));
|
||||
recipeList.Add(recipeID, recipe);
|
||||
matToRecipe[hash].Add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +306,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -326,7 +364,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -362,7 +400,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -412,7 +450,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -446,7 +484,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -494,7 +532,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -513,9 +551,13 @@ namespace Meteor.Map
|
|||
cmd.Parameters.AddWithValue("@charaId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@slot", slot);
|
||||
cmd.Parameters.AddWithValue("@questId", 0xFFFFF & quest.actorId);
|
||||
cmd.Parameters.AddWithValue("@phase", quest.GetPhase());
|
||||
cmd.Parameters.AddWithValue("@questData", quest.GetSerializedQuestData());
|
||||
cmd.Parameters.AddWithValue("@questFlags", quest.GetQuestFlags());
|
||||
|
||||
if (quest.IsScenario())
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@phase", (quest as Scenario).GetPhase());
|
||||
cmd.Parameters.AddWithValue("@questFlags", (quest as Scenario).GetQuestFlags());
|
||||
}
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
@ -535,7 +577,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -571,7 +613,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -611,7 +653,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -644,7 +686,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -677,7 +719,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -711,7 +753,7 @@ namespace Meteor.Map
|
|||
public static bool IsQuestCompleted(Player player, uint questId)
|
||||
{
|
||||
bool isCompleted = false;
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -738,7 +780,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1156,27 +1198,10 @@ namespace Meteor.Map
|
|||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
int index = reader.GetUInt16(0);
|
||||
player.playerWork.questScenario[index] = 0xA0F00000 | reader.GetUInt32(1);
|
||||
string questData = null;
|
||||
uint questFlags = 0;
|
||||
uint currentPhase = 0;
|
||||
|
||||
if (!reader.IsDBNull(2))
|
||||
questData = reader.GetString(2);
|
||||
else
|
||||
questData = "{}";
|
||||
|
||||
if (!reader.IsDBNull(3))
|
||||
questFlags = reader.GetUInt32(3);
|
||||
else
|
||||
questFlags = 0;
|
||||
|
||||
if (!reader.IsDBNull(4))
|
||||
currentPhase = reader.GetUInt32(4);
|
||||
|
||||
string questName = Server.GetStaticActors(player.playerWork.questScenario[index]).actorName;
|
||||
player.questScenario[index] = new Quest(player, player.playerWork.questScenario[index], questName, questData, questFlags, currentPhase);
|
||||
int index = reader.GetUInt16(0);
|
||||
Quest quest = Quest.LoadQuestDB(player, reader);
|
||||
player.questScenario[index] = quest;
|
||||
player.playerWork.questScenario[index] = quest.actorId;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1185,6 +1210,7 @@ namespace Meteor.Map
|
|||
SELECT
|
||||
slot,
|
||||
questId,
|
||||
questData,
|
||||
abandoned,
|
||||
completed
|
||||
FROM characters_quest_guildleve_local WHERE characterId = @charId";
|
||||
|
@ -1196,7 +1222,9 @@ namespace Meteor.Map
|
|||
while (reader.Read())
|
||||
{
|
||||
int index = reader.GetUInt16(0);
|
||||
player.playerWork.questGuildleve[index] = 0xA0F00000 | reader.GetUInt32(1);
|
||||
Quest quest = Quest.LoadQuestDB(player, reader);
|
||||
player.questGuildleve[index] = quest;
|
||||
player.playerWork.questGuildleve[index] = quest.actorId;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1267,7 +1295,7 @@ namespace Meteor.Map
|
|||
{
|
||||
InventoryItem[] equipment = new InventoryItem[player.GetEquipment().GetCapacity()];
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1311,7 +1339,7 @@ namespace Meteor.Map
|
|||
public static void EquipItem(Player player, ushort equipSlot, ulong uniqueItemId)
|
||||
{
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1348,7 +1376,7 @@ namespace Meteor.Map
|
|||
public static void UnequipItem(Player player, ushort equipSlot)
|
||||
{
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1383,7 +1411,7 @@ namespace Meteor.Map
|
|||
if (commandId > 0)
|
||||
{
|
||||
using (MySqlConnection conn = new MySqlConnection(
|
||||
String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}",
|
||||
string.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}",
|
||||
ConfigConstants.DATABASE_HOST,
|
||||
ConfigConstants.DATABASE_PORT,
|
||||
ConfigConstants.DATABASE_NAME,
|
||||
|
@ -1428,7 +1456,7 @@ namespace Meteor.Map
|
|||
public static void UnequipAbility(Player player, ushort hotbarSlot)
|
||||
{
|
||||
using (MySqlConnection conn = new MySqlConnection(
|
||||
String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}",
|
||||
string.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}",
|
||||
ConfigConstants.DATABASE_HOST,
|
||||
ConfigConstants.DATABASE_PORT,
|
||||
ConfigConstants.DATABASE_NAME,
|
||||
|
@ -1468,7 +1496,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1519,7 +1547,7 @@ namespace Meteor.Map
|
|||
{
|
||||
ushort slot = 0;
|
||||
using (MySqlConnection conn = new MySqlConnection(
|
||||
String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}",
|
||||
string.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}",
|
||||
ConfigConstants.DATABASE_HOST,
|
||||
ConfigConstants.DATABASE_PORT,
|
||||
ConfigConstants.DATABASE_NAME,
|
||||
|
@ -1571,7 +1599,7 @@ namespace Meteor.Map
|
|||
{
|
||||
List<InventoryItem> items = new List<InventoryItem>();
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1651,7 +1679,7 @@ namespace Meteor.Map
|
|||
{
|
||||
InventoryItem insertedItem = null;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1704,7 +1732,7 @@ namespace Meteor.Map
|
|||
|
||||
public static void AddItem(Character owner, InventoryItem addedItem, ushort itemPackage, ushort slot)
|
||||
{
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1739,7 +1767,7 @@ namespace Meteor.Map
|
|||
|
||||
public static void RemoveItem(Character owner, ulong serverItemId)
|
||||
{
|
||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}; Allow User Variables=True", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
using (MySqlConnection conn = new MySqlConnection(string.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}; Allow User Variables=True", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1769,7 +1797,7 @@ namespace Meteor.Map
|
|||
|
||||
public static void UpdateItemPositions(List<InventoryItem> updated)
|
||||
{
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1811,7 +1839,7 @@ namespace Meteor.Map
|
|||
|
||||
public static void SetQuantity(ulong serverItemId, int quantity)
|
||||
{
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1843,7 +1871,7 @@ namespace Meteor.Map
|
|||
|
||||
public static void SetDealingInfo(InventoryItem item)
|
||||
{
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1872,7 +1900,7 @@ namespace Meteor.Map
|
|||
|
||||
public static void ClearDealingInfo(InventoryItem item)
|
||||
{
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1902,7 +1930,7 @@ namespace Meteor.Map
|
|||
public static SubPacket GetLatestAchievements(Player player)
|
||||
{
|
||||
uint[] latestAchievements = new uint[5];
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1944,7 +1972,7 @@ namespace Meteor.Map
|
|||
{
|
||||
SetCompletedAchievementsPacket cheevosPacket = new SetCompletedAchievementsPacket();
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -1989,7 +2017,7 @@ namespace Meteor.Map
|
|||
public static SubPacket GetAchievementProgress(Player player, uint achievementId)
|
||||
{
|
||||
uint progress = 0, progressFlags = 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)))
|
||||
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
|
||||
{
|
||||
|
@ -2027,7 +2055,7 @@ namespace Meteor.Map
|
|||
public static bool CreateLinkshell(Player player, string lsName, ushort lsCrest)
|
||||
{
|
||||
bool success = false;
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2067,7 +2095,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2107,7 +2135,7 @@ namespace Meteor.Map
|
|||
MySqlCommand cmd;
|
||||
bool wasError = false;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2144,7 +2172,7 @@ namespace Meteor.Map
|
|||
public static bool isTicketOpen(string playerName)
|
||||
{
|
||||
bool isOpen = false;
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2185,7 +2213,7 @@ namespace Meteor.Map
|
|||
public static void closeTicket(string playerName)
|
||||
{
|
||||
bool isOpen = false;
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2217,7 +2245,7 @@ namespace Meteor.Map
|
|||
{
|
||||
string[] faqs = null;
|
||||
List<string> raw = new List<string>();
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2260,7 +2288,7 @@ namespace Meteor.Map
|
|||
public static string getFAQBody(uint slot, uint langCode = 1)
|
||||
{
|
||||
string body = string.Empty;
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2300,7 +2328,7 @@ namespace Meteor.Map
|
|||
{
|
||||
string[] issues = null;
|
||||
List<string> raw = new List<string>();
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2341,7 +2369,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2379,7 +2407,7 @@ namespace Meteor.Map
|
|||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2413,7 +2441,7 @@ namespace Meteor.Map
|
|||
{
|
||||
var effects = new Dictionary<uint, StatusEffect>();
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2461,7 +2489,7 @@ namespace Meteor.Map
|
|||
{
|
||||
string[] faqs = null;
|
||||
List<string> raw = new List<string>();
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2508,7 +2536,7 @@ namespace Meteor.Map
|
|||
|
||||
public static void LoadGlobalBattleCommandList(Dictionary<ushort, BattleCommand> battleCommandDict, Dictionary<Tuple<byte, short>, List<ushort>> battleCommandIdByLevel)
|
||||
{
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2608,7 +2636,7 @@ namespace Meteor.Map
|
|||
}
|
||||
}
|
||||
|
||||
Program.Log.Info(String.Format("Loaded {0} battle commands.", count));
|
||||
Program.Log.Info(string.Format("Loaded {0} battle commands.", count));
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
|
@ -2623,7 +2651,7 @@ namespace Meteor.Map
|
|||
|
||||
public static void LoadGlobalBattleTraitList(Dictionary<ushort, BattleTrait> battleTraitDict, Dictionary<byte, List<ushort>> battleTraitJobDict)
|
||||
{
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2662,7 +2690,7 @@ namespace Meteor.Map
|
|||
count++;
|
||||
}
|
||||
}
|
||||
Program.Log.Info(String.Format("Loaded {0} battle traits.", count));
|
||||
Program.Log.Info(string.Format("Loaded {0} battle traits.", count));
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
|
@ -2677,13 +2705,13 @@ namespace Meteor.Map
|
|||
|
||||
public static void SetExp(Player player, byte classId, int exp)
|
||||
{
|
||||
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)))
|
||||
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();
|
||||
|
||||
var query = String.Format(@"
|
||||
var query = string.Format(@"
|
||||
UPDATE characters_class_exp
|
||||
SET
|
||||
{0} = @exp
|
||||
|
@ -2710,13 +2738,13 @@ namespace Meteor.Map
|
|||
|
||||
public static void SetLevel(Player player, byte classId, short level)
|
||||
{
|
||||
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)))
|
||||
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();
|
||||
|
||||
var query = String.Format(@"
|
||||
var query = string.Format(@"
|
||||
UPDATE characters_class_levels
|
||||
SET
|
||||
{0} = @lvl
|
||||
|
@ -2745,7 +2773,7 @@ namespace Meteor.Map
|
|||
{
|
||||
Retainer retainer = null;
|
||||
|
||||
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)))
|
||||
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
|
||||
{
|
||||
|
@ -2843,13 +2871,13 @@ namespace Meteor.Map
|
|||
"fsh"
|
||||
};
|
||||
|
||||
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)))
|
||||
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();
|
||||
|
||||
query = String.Format(@"
|
||||
query = string.Format(@"
|
||||
UPDATE characters_class_levels
|
||||
SET
|
||||
{0}=@level
|
||||
|
|
|
@ -143,7 +143,7 @@ namespace Meteor.Map.lua
|
|||
}
|
||||
catch (ScriptRuntimeException e)
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("OnEventUpdated: {0}", e.DecoratedMessage));
|
||||
LuaEngine.SendError(player, string.Format("OnEventUpdated: {0}", e.DecoratedMessage));
|
||||
player.EndEvent();
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,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("./scripts/unique/{0}/{1}/{2}.lua", actor.zone.zoneName, actor is BattleNpc ? "Monster" : "PopulaceStandard", ((Npc)actor).GetUniqueId());
|
||||
path = string.Format("./scripts/unique/{0}/{1}/{2}.lua", actor.zone.zoneName, actor is BattleNpc ? "Monster" : "PopulaceStandard", ((Npc)actor).GetUniqueId());
|
||||
}
|
||||
// dont wanna throw an error if file doesnt exist
|
||||
if (File.Exists(path))
|
||||
|
@ -358,7 +358,7 @@ namespace Meteor.Map.lua
|
|||
{
|
||||
if (target is Player)
|
||||
{
|
||||
return String.Format(FILEPATH_PLAYER);
|
||||
return string.Format(FILEPATH_PLAYER);
|
||||
}
|
||||
else if (target is Npc)
|
||||
{
|
||||
|
@ -366,25 +366,25 @@ namespace Meteor.Map.lua
|
|||
}
|
||||
else if (target is Command)
|
||||
{
|
||||
return String.Format(FILEPATH_COMMANDS, target.GetName());
|
||||
return string.Format(FILEPATH_COMMANDS, target.GetName());
|
||||
}
|
||||
else if (target is Director)
|
||||
{
|
||||
return String.Format(FILEPATH_DIRECTORS, ((Director)target).GetScriptPath());
|
||||
return string.Format(FILEPATH_DIRECTORS, ((Director)target).GetScriptPath());
|
||||
}
|
||||
else if (target is PrivateAreaContent)
|
||||
{
|
||||
return String.Format(FILEPATH_CONTENT, ((PrivateAreaContent)target).GetPrivateAreaName());
|
||||
return string.Format(FILEPATH_CONTENT, ((PrivateAreaContent)target).GetPrivateAreaName());
|
||||
}
|
||||
else if (target is Area)
|
||||
{
|
||||
return String.Format(FILEPATH_ZONE, ((Area)target).zoneName);
|
||||
return string.Format(FILEPATH_ZONE, ((Area)target).zoneName);
|
||||
}
|
||||
else if (target is Quest)
|
||||
{
|
||||
string initial = ((Quest)target).actorName.Substring(0, 3);
|
||||
string questName = ((Quest)target).actorName;
|
||||
return String.Format(FILEPATH_QUEST, initial, questName);
|
||||
return string.Format(FILEPATH_QUEST, initial, questName);
|
||||
}
|
||||
else
|
||||
return "";
|
||||
|
@ -410,18 +410,18 @@ namespace Meteor.Map.lua
|
|||
Area area = target.zone;
|
||||
if (area is PrivateArea)
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/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("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()));
|
||||
if (File.Exists(string.Format("./scripts/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("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()));
|
||||
if (File.Exists(string.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(string.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()));
|
||||
}
|
||||
|
||||
if (parent == null && child == null)
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
||||
LuaEngine.SendError(player, string.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
||||
}
|
||||
|
||||
//Run Script
|
||||
|
@ -458,18 +458,18 @@ namespace Meteor.Map.lua
|
|||
Area area = target.zone;
|
||||
if (area is PrivateArea)
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/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("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()));
|
||||
if (File.Exists(string.Format("./scripts/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("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()));
|
||||
if (File.Exists(string.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(string.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()));
|
||||
}
|
||||
|
||||
if (parent == null && child == null)
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
LuaEngine.SendError(player, string.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -525,13 +525,13 @@ namespace Meteor.Map.lua
|
|||
else
|
||||
{
|
||||
if (!optional)
|
||||
SendError(player, String.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
SendError(player, string.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!optional)
|
||||
SendError(player, String.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
SendError(player, string.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -589,13 +589,13 @@ namespace Meteor.Map.lua
|
|||
else
|
||||
{
|
||||
if (!optional)
|
||||
SendError(player, String.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
SendError(player, string.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(target is Area) && !optional)
|
||||
SendError(player, String.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
SendError(player, string.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -616,7 +616,7 @@ namespace Meteor.Map.lua
|
|||
}
|
||||
catch (ScriptRuntimeException e)
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("OnEventStarted: {0}", e.DecoratedMessage));
|
||||
LuaEngine.SendError(player, string.Format("OnEventStarted: {0}", e.DecoratedMessage));
|
||||
player.EndEvent();
|
||||
}
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ namespace Meteor.Map.lua
|
|||
}
|
||||
|
||||
#region RunGMCommand
|
||||
public static void RunGMCommand(Player player, String cmd, string[] param, bool help = false)
|
||||
public static void RunGMCommand(Player player, string cmd, string[] param, bool help = false)
|
||||
{
|
||||
bool playerNull = player == null;
|
||||
|
||||
|
@ -676,7 +676,7 @@ namespace Meteor.Map.lua
|
|||
player = Server.GetWorldManager().GetPCInWorld(param[1] + " " + param[2]);
|
||||
|
||||
// load from scripts/commands/gm/ directory
|
||||
var path = String.Format("./scripts/commands/gm/{0}.lua", cmd.ToLower());
|
||||
var path = string.Format("./scripts/commands/gm/{0}.lua", cmd.ToLower());
|
||||
|
||||
// check if the file exists
|
||||
if (File.Exists(path))
|
||||
|
@ -747,7 +747,7 @@ namespace Meteor.Map.lua
|
|||
// i hate to do this, but cant think of a better way to keep !help
|
||||
else if (help)
|
||||
{
|
||||
player.SendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, String.Format("[Commands] [{0}]", cmd), description);
|
||||
player.SendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, string.Format("[Commands] [{0}]", cmd), description);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -851,6 +851,7 @@ namespace Meteor.Map.lua
|
|||
script.Globals["GetWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
|
||||
script.Globals["GetItemGamedata"] = (Func<uint, ItemData>)Server.GetItemGamedata;
|
||||
script.Globals["GetGuildleveGamedata"] = (Func<uint, GuildleveData>)Server.GetGuildleveGamedata;
|
||||
script.Globals["GetPassiveGLGamedata"] = (Func<uint, PassiveGuildleveData>)Server.GetPassiveGLGamedata;
|
||||
script.Globals["GetRecipeResolver"] = (Func<RecipeResolver>)Server.ResolveRecipe;
|
||||
script.Globals["GetLuaInstance"] = (Func<LuaEngine>)LuaEngine.GetInstance;
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ namespace Meteor.Map.lua
|
|||
class LuaParam
|
||||
{
|
||||
public int typeID;
|
||||
public Object value;
|
||||
public object value;
|
||||
|
||||
public LuaParam(int type, Object value)
|
||||
public LuaParam(int type, object value)
|
||||
{
|
||||
this.typeID = type;
|
||||
this.value = value;
|
||||
|
|
|
@ -25,6 +25,7 @@ using Meteor.Map.lua;
|
|||
using MoonSharp.Interpreter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
|
@ -158,7 +159,7 @@ namespace Meteor.Map
|
|||
isDone = true;
|
||||
continue;
|
||||
default:
|
||||
throw new ArgumentException("Unknown lua param...");
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
if (isDone)
|
||||
|
@ -287,22 +288,22 @@ namespace Meteor.Map
|
|||
foreach (LuaParam l in luaParams)
|
||||
{
|
||||
if (l.typeID == 0x1)
|
||||
writer.Write((Byte)0);
|
||||
writer.Write((byte)0);
|
||||
else
|
||||
writer.Write((Byte)l.typeID);
|
||||
writer.Write((byte)l.typeID);
|
||||
|
||||
switch (l.typeID)
|
||||
{
|
||||
case 0x0: //Int32
|
||||
writer.Write((Int32)Utils.SwapEndian((Int32)l.value));
|
||||
writer.Write((int)Utils.SwapEndian((int)l.value));
|
||||
break;
|
||||
case 0x1: //Int32
|
||||
writer.Write((UInt32)Utils.SwapEndian((UInt32)l.value));
|
||||
writer.Write((uint)Utils.SwapEndian((uint)l.value));
|
||||
break;
|
||||
case 0x2: //Null Termed String
|
||||
string sv = (string)l.value;
|
||||
writer.Write(Encoding.ASCII.GetBytes(sv), 0, Encoding.ASCII.GetByteCount(sv));
|
||||
writer.Write((Byte)0);
|
||||
writer.Write((byte)0);
|
||||
break;
|
||||
case 0x3: //Boolean True
|
||||
break;
|
||||
|
@ -311,21 +312,21 @@ namespace Meteor.Map
|
|||
case 0x5: //Nil
|
||||
break;
|
||||
case 0x6: //Actor (By Id)
|
||||
writer.Write((UInt32)Utils.SwapEndian((UInt32)l.value));
|
||||
writer.Write((uint)Utils.SwapEndian((uint)l.value));
|
||||
break;
|
||||
case 0x7: //Weird one used for inventory
|
||||
ItemRefParam type7 = (ItemRefParam)l.value;
|
||||
writer.Write((UInt32)Utils.SwapEndian((UInt32)type7.actorId));
|
||||
writer.Write((Byte)type7.unknown);
|
||||
writer.Write((Byte)type7.slot);
|
||||
writer.Write((Byte)type7.itemPackage);
|
||||
writer.Write((uint)Utils.SwapEndian((uint)type7.actorId));
|
||||
writer.Write((byte)type7.unknown);
|
||||
writer.Write((byte)type7.slot);
|
||||
writer.Write((byte)type7.itemPackage);
|
||||
break;
|
||||
case 0x9: //Two Longs (only storing first one)
|
||||
writer.Write((UInt64)Utils.SwapEndian(((Type9Param)l.value).item1));
|
||||
writer.Write((UInt64)Utils.SwapEndian(((Type9Param)l.value).item2));
|
||||
writer.Write((ulong)Utils.SwapEndian(((Type9Param)l.value).item1));
|
||||
writer.Write((ulong)Utils.SwapEndian(((Type9Param)l.value).item2));
|
||||
break;
|
||||
case 0xC: //Byte
|
||||
writer.Write((Byte)l.value);
|
||||
writer.Write((byte)l.value);
|
||||
break;
|
||||
case 0x1B: //Short?
|
||||
break;
|
||||
|
@ -334,7 +335,7 @@ namespace Meteor.Map
|
|||
}
|
||||
}
|
||||
|
||||
writer.Write((Byte)0xF);
|
||||
writer.Write((byte)0xF);
|
||||
}
|
||||
|
||||
public static List<LuaParam> CreateLuaParamList(DynValue fromScript)
|
||||
|
@ -417,7 +418,7 @@ namespace Meteor.Map
|
|||
{
|
||||
luaParams.Add(new LuaParam(0x1, (uint)o));
|
||||
}
|
||||
else if (o is Double)
|
||||
else if (o is double)
|
||||
{
|
||||
if (((double)o) % 1 == 0)
|
||||
luaParams.Add(new LuaParam(0x0, (int)(double)o));
|
||||
|
@ -481,13 +482,13 @@ namespace Meteor.Map
|
|||
switch (lParams[i].typeID)
|
||||
{
|
||||
case 0x0: //Int32
|
||||
dumpString += String.Format("0x{0:X}", (int)lParams[i].value);
|
||||
dumpString += string.Format("0x{0:X}", (int)lParams[i].value);
|
||||
break;
|
||||
case 0x1: //Int32
|
||||
dumpString += String.Format("0x{0:X}", (uint)lParams[i].value);
|
||||
dumpString += string.Format("0x{0:X}", (uint)lParams[i].value);
|
||||
break;
|
||||
case 0x2: //Null Termed String
|
||||
dumpString += String.Format("\"{0}\"", (string)lParams[i].value);
|
||||
dumpString += string.Format("\"{0}\"", (string)lParams[i].value);
|
||||
break;
|
||||
case 0x3: //Boolean True
|
||||
dumpString += "true";
|
||||
|
@ -499,25 +500,25 @@ namespace Meteor.Map
|
|||
dumpString += "nil";
|
||||
break;
|
||||
case 0x6: //Actor (By Id)
|
||||
dumpString += String.Format("0x{0:X}", (uint)lParams[i].value);
|
||||
dumpString += string.Format("0x{0:X}", (uint)lParams[i].value);
|
||||
break;
|
||||
case 0x7: //Weird one used for inventory
|
||||
ItemRefParam type7Param = ((ItemRefParam)lParams[i].value);
|
||||
dumpString += String.Format("Type7 Param: (0x{0:X}, 0x{1:X}, 0x{2:X}, 0x{3:X})", type7Param.actorId, type7Param.unknown, type7Param.slot, type7Param.itemPackage);
|
||||
dumpString += string.Format("Type7 Param: (0x{0:X}, 0x{1:X}, 0x{2:X}, 0x{3:X})", type7Param.actorId, type7Param.unknown, type7Param.slot, type7Param.itemPackage);
|
||||
break;
|
||||
case 0x8: //Weird one used for inventory
|
||||
ItemOfferParam itemOfferParam = ((ItemOfferParam)lParams[i].value);
|
||||
dumpString += String.Format("Type8 Param: (0x{0:X}, 0x{1:X}, 0x{2:X}, 0x{3:X}, 0x{4:X}, 0x{5:X}, 0x{6:X})", itemOfferParam.actorId, itemOfferParam.offerSlot, itemOfferParam.offerPackageId, itemOfferParam.unknown1, itemOfferParam.seekSlot, itemOfferParam.seekPackageId, itemOfferParam.unknown2);
|
||||
dumpString += string.Format("Type8 Param: (0x{0:X}, 0x{1:X}, 0x{2:X}, 0x{3:X}, 0x{4:X}, 0x{5:X}, 0x{6:X})", itemOfferParam.actorId, itemOfferParam.offerSlot, itemOfferParam.offerPackageId, itemOfferParam.unknown1, itemOfferParam.seekSlot, itemOfferParam.seekPackageId, itemOfferParam.unknown2);
|
||||
break;
|
||||
case 0x9: //Long (+ 8 bytes ignored)
|
||||
Type9Param type9Param = ((Type9Param)lParams[i].value);
|
||||
dumpString += String.Format("Type9 Param: (0x{0:X}, 0x{1:X})", type9Param.item1, type9Param.item2);
|
||||
dumpString += string.Format("Type9 Param: (0x{0:X}, 0x{1:X})", type9Param.item1, type9Param.item2);
|
||||
break;
|
||||
case 0xC: //Byte
|
||||
dumpString += String.Format("0x{0:X}", (byte)lParams[i].value);
|
||||
dumpString += string.Format("0x{0:X}", (byte)lParams[i].value);
|
||||
break;
|
||||
case 0x1B: //Short?
|
||||
dumpString += String.Format("0x{0:X}", (ushort)lParams[i].value);
|
||||
dumpString += string.Format("0x{0:X}", (ushort)lParams[i].value);
|
||||
break;
|
||||
case 0xF: //End
|
||||
break;
|
||||
|
|
|
@ -164,9 +164,12 @@
|
|||
<Compile Include="Actors\Group\Work\PartyWork.cs" />
|
||||
<Compile Include="Actors\Group\Work\RelationWork.cs" />
|
||||
<Compile Include="Actors\Judge\Judge.cs" />
|
||||
<Compile Include="Actors\Quest\Scenario.cs" />
|
||||
<Compile Include="Actors\Quest\PassiveGuildleve.cs" />
|
||||
<Compile Include="Actors\Quest\Quest.cs" />
|
||||
<Compile Include="Actors\StaticActors.cs" />
|
||||
<Compile Include="Actors\World\WorldMaster.cs" />
|
||||
<Compile Include="DataObjects\PassiveGuildleveData.cs" />
|
||||
<Compile Include="DataObjects\GuildleveData.cs" />
|
||||
<Compile Include="DataObjects\Recipe.cs" />
|
||||
<Compile Include="DataObjects\RecipeResolver.cs" />
|
||||
|
|
|
@ -27,6 +27,7 @@ using Meteor.Map.dataobjects;
|
|||
|
||||
using Meteor.Common;
|
||||
using Meteor.Map.Actors;
|
||||
using Meteor.Map.DataObjects;
|
||||
|
||||
namespace Meteor.Map
|
||||
{
|
||||
|
@ -47,11 +48,15 @@ namespace Meteor.Map
|
|||
private static CommandProcessor mCommandProcessor = new CommandProcessor();
|
||||
private static ZoneConnection mWorldConnection = new ZoneConnection();
|
||||
private static WorldManager mWorldManager;
|
||||
private static Dictionary<uint, ItemData> mGamedataItems;
|
||||
private static Dictionary<uint, GuildleveData> mGamedataGuildleves;
|
||||
private static StaticActors mStaticActors;
|
||||
|
||||
private PacketProcessor mProcessor;
|
||||
private PacketProcessor mProcessor;
|
||||
|
||||
//Game Data
|
||||
private static Dictionary<uint, ItemData> gamedataItems;
|
||||
private static Dictionary<uint, GuildleveData> gamedataGuildleves;
|
||||
private static Dictionary<uint, PassiveGuildleveData> gamedataPassiveGL;
|
||||
private static RecipeResolver gamedataRecipeResolver;
|
||||
|
||||
public Server()
|
||||
{
|
||||
|
@ -62,10 +67,14 @@ namespace Meteor.Map
|
|||
{
|
||||
mStaticActors = new StaticActors(STATIC_ACTORS_PATH);
|
||||
|
||||
mGamedataItems = Database.GetItemGamedata();
|
||||
Program.Log.Info("Loaded {0} items.", mGamedataItems.Count);
|
||||
mGamedataGuildleves = Database.GetGuildleveGamedata();
|
||||
Program.Log.Info("Loaded {0} guildleves.", mGamedataGuildleves.Count);
|
||||
gamedataItems = Database.GetItemGamedata();
|
||||
Program.Log.Info("Loaded {0} items.", gamedataItems.Count);
|
||||
gamedataGuildleves = Database.GetGuildleveGamedata();
|
||||
Program.Log.Info("Loaded {0} guildleves.", gamedataGuildleves.Count);
|
||||
gamedataPassiveGL = Database.GetPassiveGuildleveGamedata();
|
||||
Program.Log.Info("Loaded {0} passive (local) guildleves.", gamedataPassiveGL.Count);
|
||||
gamedataRecipeResolver = RecipeResolver.Init();
|
||||
Program.Log.Info("Loaded {0} crafting recipes.", gamedataRecipeResolver.GetNumRecipes());
|
||||
|
||||
mWorldManager = new WorldManager(this);
|
||||
mWorldManager.LoadZoneList();
|
||||
|
@ -299,7 +308,7 @@ namespace Meteor.Map
|
|||
|
||||
public static Dictionary<uint, ItemData> GetGamedataItems()
|
||||
{
|
||||
return mGamedataItems;
|
||||
return gamedataItems;
|
||||
}
|
||||
|
||||
public static Actor GetStaticActors(uint id)
|
||||
|
@ -314,19 +323,31 @@ namespace Meteor.Map
|
|||
|
||||
public static ItemData GetItemGamedata(uint id)
|
||||
{
|
||||
if (mGamedataItems.ContainsKey(id))
|
||||
return mGamedataItems[id];
|
||||
if (gamedataItems.ContainsKey(id))
|
||||
return gamedataItems[id];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static GuildleveData GetGuildleveGamedata(uint id)
|
||||
{
|
||||
if (mGamedataGuildleves.ContainsKey(id))
|
||||
return mGamedataGuildleves[id];
|
||||
if (gamedataGuildleves.ContainsKey(id))
|
||||
return gamedataGuildleves[id];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PassiveGuildleveData GetPassiveGLGamedata(uint id)
|
||||
{
|
||||
if (gamedataPassiveGL.ContainsKey(id))
|
||||
return gamedataPassiveGL[id];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static RecipeResolver ResolveRecipe()
|
||||
{
|
||||
return gamedataRecipeResolver;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace Meteor.Map.utils
|
|||
return faceInfo;
|
||||
}
|
||||
|
||||
public static UInt32 GetTribeModel(byte tribe)
|
||||
public static uint GetTribeModel(byte tribe)
|
||||
{
|
||||
switch (tribe)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue