mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-10 22:44:36 +02:00
Updated Map Server namespace. Moved all other data folders (www and sql) to data folder. Renamed boot name to Project Meteor.
This commit is contained in:
parent
18ef69f3d1
commit
91549bff7a
1823 changed files with 102704 additions and 901 deletions
77
Map Server/DataObjects/GuildleveData.cs
Normal file
77
Map Server/DataObjects/GuildleveData.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
===========================================================================
|
||||
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 GuildleveData
|
||||
{
|
||||
public readonly uint id;
|
||||
public readonly uint classType;
|
||||
public readonly uint location;
|
||||
public readonly ushort factionCreditRequired;
|
||||
public readonly ushort level;
|
||||
public readonly uint aetheryte;
|
||||
public readonly uint plateId;
|
||||
public readonly uint borderId;
|
||||
public readonly uint objective;
|
||||
public readonly byte timeLimit;
|
||||
public readonly uint skill;
|
||||
public readonly byte favorCount;
|
||||
|
||||
public readonly sbyte[] aimNum = new sbyte[4];
|
||||
public readonly uint[] itemTarget = new uint[4];
|
||||
public readonly uint[] mobTarget = new uint[4];
|
||||
|
||||
public GuildleveData(MySqlDataReader reader)
|
||||
{
|
||||
id = reader.GetUInt32("id");
|
||||
classType = reader.GetUInt32("classType");
|
||||
location = reader.GetUInt32("location");
|
||||
factionCreditRequired = reader.GetUInt16("factionCreditRequired");
|
||||
level = reader.GetUInt16("level");
|
||||
aetheryte = reader.GetUInt32("aetheryte");
|
||||
plateId = reader.GetUInt32("plateId");
|
||||
borderId = reader.GetUInt32("borderId");
|
||||
objective = reader.GetUInt32("objective");
|
||||
timeLimit = reader.GetByte("timeLimit");
|
||||
skill = reader.GetUInt32("skill");
|
||||
favorCount = reader.GetByte("favorCount");
|
||||
|
||||
aimNum[0] = reader.GetSByte("aimNum1");
|
||||
aimNum[1] = reader.GetSByte("aimNum2");
|
||||
aimNum[2] = reader.GetSByte("aimNum3");
|
||||
aimNum[3] = reader.GetSByte("aimNum4");
|
||||
|
||||
itemTarget[0] = reader.GetUInt32("item1");
|
||||
itemTarget[1] = reader.GetUInt32("item2");
|
||||
itemTarget[2] = reader.GetUInt32("item3");
|
||||
itemTarget[3] = reader.GetUInt32("item4");
|
||||
|
||||
mobTarget[0] = reader.GetUInt32("mob1");
|
||||
mobTarget[1] = reader.GetUInt32("mob2");
|
||||
mobTarget[2] = reader.GetUInt32("mob3");
|
||||
mobTarget[3] = reader.GetUInt32("mob4");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
436
Map Server/DataObjects/InventoryItem.cs
Normal file
436
Map Server/DataObjects/InventoryItem.cs
Normal file
|
@ -0,0 +1,436 @@
|
|||
/*
|
||||
===========================================================================
|
||||
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.actors.chara.player;
|
||||
using Meteor.Map.Actors;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Meteor.Map.dataobjects
|
||||
{
|
||||
class InventoryItem
|
||||
{
|
||||
public const byte DEALINGMODE_NONE = 0;
|
||||
public const byte DEALINGMODE_REFERENCED = 1;
|
||||
public const byte DEALINGMODE_PRICED = 2;
|
||||
|
||||
public const byte TAG_EXCLUSIVE = 0x3;
|
||||
public const byte TAG_DEALING = 0xC9;
|
||||
public const byte TAG_ATTACHED = 0xCA;
|
||||
|
||||
public const byte MODE_SELL_SINGLE = 11; //0xB
|
||||
public const byte MODE_SELL_PSTACK = 12; //0xC
|
||||
public const byte MODE_SELL_FSTACK = 13; //0xD
|
||||
public const byte MODE_SEEK_ITEM = 20; //0x14
|
||||
public const byte MODE_SEEK_REPAIR = 30; //0x1E
|
||||
public const byte MODE_SEEK_MELD = 40; //0x28
|
||||
|
||||
public ulong uniqueId;
|
||||
public uint itemId;
|
||||
public int quantity = 1;
|
||||
|
||||
private byte dealingVal = 0;
|
||||
private byte dealingMode = DEALINGMODE_NONE;
|
||||
private int dealingAttached1 = 0;
|
||||
private int dealingAttached2 = 0;
|
||||
private int dealingAttached3 = 0;
|
||||
|
||||
private byte[] tags = new byte[4];
|
||||
private byte[] tagValues = new byte[4];
|
||||
|
||||
public byte quality = 1;
|
||||
|
||||
public ItemModifier modifiers;
|
||||
|
||||
public readonly ItemData itemData;
|
||||
public Character owner = null;
|
||||
public ushort slot = 0xFFFF;
|
||||
public ushort linkSlot = 0xFFFF;
|
||||
public ushort itemPackage = 0xFFFF;
|
||||
|
||||
public class ItemModifier
|
||||
{
|
||||
public uint durability = 0;
|
||||
public ushort use = 0;
|
||||
public uint materiaId = 0;
|
||||
public uint materiaLife = 0;
|
||||
public byte mainQuality = 0;
|
||||
public byte[] subQuality = new byte[3];
|
||||
public uint polish = 0;
|
||||
public uint param1 = 0;
|
||||
public uint param2 = 0;
|
||||
public uint param3 = 0;
|
||||
public ushort spiritbind = 0;
|
||||
public byte[] materiaType = new byte[5];
|
||||
public byte[] materiaGrade = new byte[5];
|
||||
|
||||
public ItemModifier()
|
||||
{
|
||||
}
|
||||
|
||||
public ItemModifier(MySql.Data.MySqlClient.MySqlDataReader reader)
|
||||
{
|
||||
durability = reader.GetUInt32("durability");
|
||||
mainQuality = reader.GetByte("mainQuality");
|
||||
subQuality[0] = reader.GetByte("subQuality1");
|
||||
subQuality[1] = reader.GetByte("subQuality2");
|
||||
subQuality[2] = reader.GetByte("subQuality3");
|
||||
param1 = reader.GetUInt32("param1");
|
||||
param2 = reader.GetUInt32("param2");
|
||||
param3 = reader.GetUInt32("param3");
|
||||
spiritbind = reader.GetUInt16("spiritbind");
|
||||
|
||||
ushort materia1 = reader.GetUInt16("materia1");
|
||||
ushort materia2 = reader.GetUInt16("materia2");
|
||||
ushort materia3 = reader.GetUInt16("materia3");
|
||||
ushort materia4 = reader.GetUInt16("materia4");
|
||||
ushort materia5 = reader.GetUInt16("materia5");
|
||||
|
||||
materiaType[0] = (byte)(materia1 & 0xFF);
|
||||
materiaGrade[0] = (byte)((materia1 >> 8) & 0xFF);
|
||||
materiaType[1] = (byte)(materia2 & 0xFF);
|
||||
materiaGrade[1] = (byte)((materia2 >> 8) & 0xFF);
|
||||
materiaType[2] = (byte)(materia3 & 0xFF);
|
||||
materiaGrade[2] = (byte)((materia3 >> 8) & 0xFF);
|
||||
materiaType[3] = (byte)(materia4 & 0xFF);
|
||||
materiaGrade[3] = (byte)((materia4 >> 8) & 0xFF);
|
||||
materiaType[4] = (byte)(materia5 & 0xFF);
|
||||
materiaGrade[4] = (byte)((materia5 >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
public void WriteBytes(BinaryWriter binWriter)
|
||||
{
|
||||
binWriter.Write((UInt32) durability);
|
||||
binWriter.Write((UInt16) use);
|
||||
binWriter.Write((UInt32) materiaId);
|
||||
binWriter.Write((UInt32) materiaLife);
|
||||
binWriter.Write((Byte) mainQuality);
|
||||
binWriter.Write((Byte) subQuality[0]);
|
||||
binWriter.Write((Byte) subQuality[1]);
|
||||
binWriter.Write((Byte) subQuality[2]);
|
||||
binWriter.Write((UInt32) polish);
|
||||
binWriter.Write((UInt32) param1);
|
||||
binWriter.Write((UInt32) param2);
|
||||
binWriter.Write((UInt32) param3);
|
||||
binWriter.Write((UInt16) spiritbind);
|
||||
binWriter.Write((Byte) materiaType[0]);
|
||||
binWriter.Write((Byte) materiaType[1]);
|
||||
binWriter.Write((Byte) materiaType[2]);
|
||||
binWriter.Write((Byte) materiaType[3]);
|
||||
binWriter.Write((Byte) materiaType[4]);
|
||||
binWriter.Write((Byte) materiaGrade[0]);
|
||||
binWriter.Write((Byte) materiaGrade[1]);
|
||||
binWriter.Write((Byte) materiaGrade[2]);
|
||||
binWriter.Write((Byte) materiaGrade[3]);
|
||||
binWriter.Write((Byte) materiaGrade[4]);
|
||||
}
|
||||
}
|
||||
|
||||
//For loading already existing items
|
||||
public InventoryItem(MySqlDataReader reader)
|
||||
{
|
||||
uniqueId = reader.GetUInt32("serverItemId");
|
||||
itemId = reader.GetUInt32("itemId");
|
||||
itemData = Server.GetItemGamedata(itemId);
|
||||
quantity = reader.GetInt32("quantity");
|
||||
quality = reader.GetByte("quality");
|
||||
|
||||
bool hasDealing = !reader.IsDBNull(reader.GetOrdinal("bazaarMode"));
|
||||
if (hasDealing)
|
||||
{
|
||||
dealingVal = reader.GetByte("dealingValue");
|
||||
dealingMode = reader.GetByte("dealingMode");
|
||||
dealingAttached1 = reader.GetInt32("dealingAttached1");
|
||||
dealingAttached2 = reader.GetInt32("dealingAttached2");
|
||||
dealingAttached3 = reader.GetInt32("dealingAttached3");
|
||||
tags[0] = reader.GetByte("dealingTag");
|
||||
tagValues[0] = reader.GetByte("bazaarMode");
|
||||
}
|
||||
|
||||
bool hasModifiers = !reader.IsDBNull(reader.GetOrdinal("modifierId"));
|
||||
if (hasModifiers)
|
||||
modifiers = new InventoryItem.ItemModifier(reader);
|
||||
|
||||
tags[1] = itemData.isExclusive ? TAG_EXCLUSIVE : (byte)0;
|
||||
}
|
||||
|
||||
//For creating new items (only should be called by the DB)
|
||||
public InventoryItem(uint uniqueId, uint itemId, int quantity, byte qualityNumber, ItemModifier modifiers = null)
|
||||
{
|
||||
this.uniqueId = uniqueId;
|
||||
this.itemId = itemId;
|
||||
this.itemData = Server.GetItemGamedata(itemId);
|
||||
this.quantity = quantity;
|
||||
this.quality = qualityNumber;
|
||||
this.modifiers = modifiers;
|
||||
|
||||
tags[1] = itemData.isExclusive ? TAG_EXCLUSIVE : (byte)0;
|
||||
}
|
||||
|
||||
public void SaveDealingInfo(MySqlCommand cmd)
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@serverItemId", uniqueId);
|
||||
cmd.Parameters.AddWithValue("@dealingValue", dealingVal);
|
||||
cmd.Parameters.AddWithValue("@dealingMode", dealingMode);
|
||||
cmd.Parameters.AddWithValue("@dealingAttached1", dealingAttached1);
|
||||
cmd.Parameters.AddWithValue("@dealingAttached2", dealingAttached2);
|
||||
cmd.Parameters.AddWithValue("@dealingAttached3", dealingAttached3);
|
||||
cmd.Parameters.AddWithValue("@dealingTag", tags[0]);
|
||||
cmd.Parameters.AddWithValue("@bazaarMode", tagValues[0]);
|
||||
}
|
||||
|
||||
public byte[] ToPacketBytes()
|
||||
{
|
||||
byte[] data = new byte[0x70];
|
||||
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
binWriter.Write((UInt64)uniqueId);
|
||||
binWriter.Write((Int32)quantity);
|
||||
binWriter.Write((UInt32)itemId);
|
||||
|
||||
if (linkSlot == 0xFFFF)
|
||||
binWriter.Write((UInt16)slot);
|
||||
else
|
||||
binWriter.Write((UInt16)linkSlot);
|
||||
linkSlot = 0xFFFF;
|
||||
|
||||
binWriter.Write((Byte)dealingVal);
|
||||
binWriter.Write((Byte)dealingMode);
|
||||
|
||||
binWriter.Write((UInt32)dealingAttached1);
|
||||
binWriter.Write((UInt32)dealingAttached2);
|
||||
binWriter.Write((UInt32)dealingAttached3);
|
||||
|
||||
for (int i = 0; i < tags.Length; i++)
|
||||
binWriter.Write((Byte) tags[i]);
|
||||
for (int i = 0; i < tagValues.Length; i++)
|
||||
binWriter.Write((Byte) tagValues[i]);
|
||||
|
||||
binWriter.Write((Byte)quality);
|
||||
|
||||
if (modifiers != null)
|
||||
{
|
||||
binWriter.Write((Byte)0x01);
|
||||
modifiers.WriteBytes(binWriter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public void SetQuantity(uint quantity)
|
||||
{
|
||||
lock (owner.GetItemPackage(itemPackage))
|
||||
{
|
||||
this.quantity = (int)quantity;
|
||||
if (quantity < 0)
|
||||
quantity = 0;
|
||||
Database.SetQuantity(uniqueId, this.quantity);
|
||||
|
||||
if (owner != null)
|
||||
owner.GetItemPackage(itemPackage).MarkDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeQuantity(int quantityDelta)
|
||||
{
|
||||
lock (owner.GetItemPackage(itemPackage))
|
||||
{
|
||||
this.quantity += quantityDelta;
|
||||
if (quantity < 0)
|
||||
quantity = 0;
|
||||
|
||||
if (quantity == 0)
|
||||
{
|
||||
owner.RemoveItem(this);
|
||||
return;
|
||||
}
|
||||
|
||||
Database.SetQuantity(uniqueId, this.quantity);
|
||||
|
||||
if (owner != null)
|
||||
owner.GetItemPackage(itemPackage).MarkDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetOwner(Character owner, ushort itemPackage, ushort slot)
|
||||
{
|
||||
this.owner = owner;
|
||||
this.itemPackage = itemPackage;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public void ClearOwner()
|
||||
{
|
||||
owner = null;
|
||||
itemPackage = 0xFFFF;
|
||||
slot = 0xFFFF;
|
||||
}
|
||||
|
||||
public void SetNormal()
|
||||
{
|
||||
if (dealingMode != 0 || tags[0] == TAG_ATTACHED)
|
||||
Database.ClearDealingInfo(this);
|
||||
|
||||
tags[0] = 0;
|
||||
tagValues[0] = 0;
|
||||
dealingVal = 0;
|
||||
dealingMode = 0;
|
||||
dealingAttached1 = 0;
|
||||
dealingAttached2 = 0;
|
||||
dealingAttached3 = 0;
|
||||
|
||||
if (owner != null)
|
||||
owner.GetItemPackage(itemPackage).MarkDirty(this);
|
||||
}
|
||||
|
||||
public void SetSelling(byte mode, int price)
|
||||
{
|
||||
tags[0] = TAG_DEALING;
|
||||
tagValues[0] = mode;
|
||||
|
||||
dealingVal = 0;
|
||||
dealingMode = DEALINGMODE_PRICED;
|
||||
dealingAttached1 = 0;
|
||||
dealingAttached2 = price;
|
||||
dealingAttached3 = 0;
|
||||
|
||||
if (owner != null)
|
||||
owner.GetItemPackage(itemPackage).MarkDirty(this);
|
||||
|
||||
Database.SetDealingInfo(this);
|
||||
}
|
||||
|
||||
public void SetAsOfferTo(byte mode, InventoryItem seeked)
|
||||
{
|
||||
tags[0] = TAG_DEALING;
|
||||
tagValues[0] = mode;
|
||||
|
||||
dealingVal = 0;
|
||||
dealingMode = DEALINGMODE_REFERENCED;
|
||||
dealingAttached1 = ((seeked.itemPackage << 16) | seeked.slot);
|
||||
dealingAttached2 = 0;
|
||||
dealingAttached3 = 0;
|
||||
|
||||
seeked.SetSeeking();
|
||||
|
||||
if (owner != null)
|
||||
owner.GetItemPackage(itemPackage).MarkDirty(this);
|
||||
|
||||
Database.SetDealingInfo(this);
|
||||
}
|
||||
|
||||
public void UpdateOfferedSlot(ushort delta)
|
||||
{
|
||||
if (dealingMode == DEALINGMODE_REFERENCED)
|
||||
{
|
||||
ushort attachedItemPackage = (ushort)((dealingAttached1 >> 16) & 0xFF);
|
||||
ushort attachedSlot = (ushort)(dealingAttached1 & 0xFF);
|
||||
attachedSlot -= delta;
|
||||
dealingAttached1 = ((attachedItemPackage << 16) | attachedSlot);
|
||||
Database.SetDealingInfo(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected void SetSeeking()
|
||||
{
|
||||
tags[0] = TAG_ATTACHED;
|
||||
tagValues[0] = 0;
|
||||
|
||||
dealingVal = 0;
|
||||
dealingMode = DEALINGMODE_NONE;
|
||||
dealingAttached1 = 0;
|
||||
dealingAttached2 = 0;
|
||||
dealingAttached3 = 0;
|
||||
|
||||
if (owner != null)
|
||||
owner.GetItemPackage(itemPackage).MarkDirty(this);
|
||||
|
||||
Database.SetDealingInfo(this);
|
||||
}
|
||||
|
||||
public void SetTradeQuantity(int quantity)
|
||||
{
|
||||
tags[0] = 0;
|
||||
tagValues[0] = 0;
|
||||
|
||||
dealingVal = 0;
|
||||
dealingMode = DEALINGMODE_NONE;
|
||||
dealingAttached1 = 0;
|
||||
dealingAttached2 = 0;
|
||||
dealingAttached3 = quantity;
|
||||
|
||||
if (owner != null)
|
||||
owner.GetItemPackage(itemPackage).MarkDirty(this);
|
||||
}
|
||||
|
||||
public int GetTradeQuantity()
|
||||
{
|
||||
return dealingAttached3;
|
||||
}
|
||||
|
||||
public InventoryItem GetOfferedTo()
|
||||
{
|
||||
if (dealingMode != DEALINGMODE_REFERENCED)
|
||||
return null;
|
||||
|
||||
ushort attachedItemPackage = (ushort)((dealingAttached1 >> 16) & 0xFF);
|
||||
ushort attachedSlot = (ushort)(dealingAttached1 & 0xFF);
|
||||
return owner.GetItemPackage(attachedItemPackage).GetItemAtSlot(attachedSlot);
|
||||
}
|
||||
|
||||
public bool IsSelling()
|
||||
{
|
||||
return GetBazaarMode() == MODE_SELL_SINGLE || GetBazaarMode() == MODE_SELL_PSTACK || GetBazaarMode() == MODE_SELL_FSTACK;
|
||||
}
|
||||
|
||||
public byte GetBazaarMode()
|
||||
{
|
||||
if (tags[0] == 0xC9)
|
||||
return tagValues[0];
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ItemData GetItemData()
|
||||
{
|
||||
return itemData;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (itemData != null)
|
||||
{
|
||||
if (quantity <= 1)
|
||||
return string.Format("{0}+{1} ({2}/{3})", itemData.name, quality-1, quantity, itemData.maxStack);
|
||||
else
|
||||
return string.Format("{0} ({1}/{2})", itemData.name, quantity, itemData.maxStack);
|
||||
}
|
||||
else
|
||||
return "Invalid Item";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
617
Map Server/DataObjects/ItemData.cs
Normal file
617
Map Server/DataObjects/ItemData.cs
Normal file
|
@ -0,0 +1,617 @@
|
|||
/*
|
||||
===========================================================================
|
||||
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;
|
||||
using System;
|
||||
|
||||
namespace Meteor.Map.dataobjects
|
||||
{
|
||||
class ItemData
|
||||
{
|
||||
//Basic
|
||||
public readonly uint catalogID;
|
||||
public readonly string name;
|
||||
|
||||
//_item sheet
|
||||
public readonly string category;
|
||||
public readonly int maxStack;
|
||||
public readonly bool isRare;
|
||||
public readonly bool isExclusive;
|
||||
|
||||
//itemData sheet
|
||||
public readonly int durability;
|
||||
public readonly int sellPrice;
|
||||
public readonly int icon;
|
||||
public readonly int kind;
|
||||
public readonly int rarity;
|
||||
public readonly int isUseable;
|
||||
public readonly int mainSkill;
|
||||
public readonly int subSkill;
|
||||
public readonly int levelType;
|
||||
public readonly int level;
|
||||
public readonly int compatibility;
|
||||
public readonly float effectMagnitude;
|
||||
public readonly float effectRate;
|
||||
public readonly float shieldBlocking;
|
||||
public readonly float effectDuration;
|
||||
public readonly float recastTime;
|
||||
public readonly byte recastGroup;
|
||||
public readonly int repairSkill;
|
||||
public readonly int repairItem;
|
||||
public readonly int repairItemNum;
|
||||
public readonly int repairLevel;
|
||||
public readonly int repairLicense;
|
||||
|
||||
public ItemData(MySqlDataReader reader)
|
||||
{
|
||||
catalogID = reader.GetUInt32("catalogID");
|
||||
name = reader.GetString("name");
|
||||
|
||||
category = reader.GetString("category");
|
||||
maxStack = reader.GetInt32("maxStack");
|
||||
isRare = reader.GetBoolean("isRare");
|
||||
isExclusive = reader.GetBoolean("isExclusive");
|
||||
|
||||
durability = reader.GetInt32("durability");
|
||||
sellPrice = reader.GetInt32("sellPrice");
|
||||
|
||||
icon = reader.GetInt32("icon");
|
||||
kind = reader.GetInt32("kind");
|
||||
rarity = reader.GetInt32("rarity");
|
||||
isUseable = reader.GetInt32("isUseable");
|
||||
mainSkill = reader.GetInt32("mainSkill");
|
||||
subSkill = reader.GetInt32("subSkill");
|
||||
levelType = reader.GetInt32("levelType");
|
||||
level = reader.GetInt32("level");
|
||||
compatibility = reader.GetInt32("compatibility");
|
||||
effectMagnitude = reader.GetFloat("effectMagnitude");
|
||||
effectRate = reader.GetFloat("effectRate");
|
||||
shieldBlocking = reader.GetFloat("shieldBlocking");
|
||||
effectDuration = reader.GetFloat("effectDuration");
|
||||
recastTime = reader.GetFloat("recastTime");
|
||||
recastGroup = reader.GetByte("recastGroup");
|
||||
repairSkill = reader.GetInt32("repairSkill");
|
||||
repairItem = reader.GetInt32("repairItem");
|
||||
repairItemNum = reader.GetInt32("repairItemNum");
|
||||
repairLevel = reader.GetInt32("repairLevel");
|
||||
repairLicense = reader.GetInt32("repairLicense");
|
||||
}
|
||||
|
||||
#region Utility Functions
|
||||
public bool IsMoney()
|
||||
{
|
||||
return catalogID >= 1000000 && catalogID <= 1999999;
|
||||
}
|
||||
|
||||
public bool IsImportant()
|
||||
{
|
||||
return catalogID >= 2000001 && catalogID <= 2002048;
|
||||
}
|
||||
|
||||
public bool IsFood()
|
||||
{
|
||||
return catalogID >= 3010000 && catalogID <= 3019999;
|
||||
}
|
||||
|
||||
public bool IsDrink()
|
||||
{
|
||||
return catalogID >= 3010600 && catalogID <= 3010699;
|
||||
}
|
||||
|
||||
public bool IsPotion()
|
||||
{
|
||||
return catalogID >= 3020000 && catalogID <= 3029999;
|
||||
}
|
||||
|
||||
public bool IsEquipment()
|
||||
{
|
||||
return catalogID >= 3900000 && catalogID <= 9999999;
|
||||
}
|
||||
|
||||
public bool IsWeapon()
|
||||
{
|
||||
return catalogID >= 3900000 && catalogID <= 7999999;
|
||||
}
|
||||
|
||||
public static bool IsWeapon(uint catalogID)
|
||||
{
|
||||
return catalogID >= 3900000 && catalogID <= 7999999;
|
||||
}
|
||||
|
||||
public bool IsBattleWeapon()
|
||||
{
|
||||
return catalogID >= 3900000 && catalogID <= 5999999;
|
||||
}
|
||||
|
||||
public bool IsAttackWeapon()
|
||||
{
|
||||
return catalogID >= 4020000 && catalogID <= 4999999;
|
||||
}
|
||||
|
||||
public bool IsNailWeapon()
|
||||
{
|
||||
return catalogID >= 4020000 && catalogID <= 4029999;
|
||||
}
|
||||
|
||||
public bool IsSwordWeapon()
|
||||
{
|
||||
return catalogID >= 4030000 && catalogID <= 4039999;
|
||||
}
|
||||
|
||||
public bool IsAxeWeapon()
|
||||
{
|
||||
return catalogID >= 4040000 && catalogID <= 4049999;
|
||||
}
|
||||
|
||||
public bool IsRapierWeapon()
|
||||
{
|
||||
return catalogID >= 4050000 && catalogID <= 4059999;
|
||||
}
|
||||
|
||||
public bool IsMaceWeapon()
|
||||
{
|
||||
return catalogID >= 4060000 && catalogID <= 4069999;
|
||||
}
|
||||
|
||||
public bool IsBowWeapon()
|
||||
{
|
||||
return catalogID >= 4070000 && catalogID <= 4079999;
|
||||
}
|
||||
|
||||
public bool IsLanceWeapon()
|
||||
{
|
||||
return catalogID >= 4080000 && catalogID <= 4089999;
|
||||
}
|
||||
|
||||
public bool IsGunWeapon()
|
||||
{
|
||||
return catalogID >= 4090000 && catalogID <= 4099999;
|
||||
}
|
||||
|
||||
public bool IsLongRangeWeapon()
|
||||
{
|
||||
return catalogID >= 4050000 && catalogID <= 4059999;
|
||||
}
|
||||
|
||||
public bool IsShotWeapon()
|
||||
{
|
||||
return !IsBowWeapon() ? IsGunWeapon() : false;
|
||||
}
|
||||
|
||||
public bool IsAmmoWeapon()
|
||||
{
|
||||
return !IsThrowWeapon() && !IsArrowWeapon();
|
||||
}
|
||||
|
||||
public bool IsThrowWeapon()
|
||||
{
|
||||
return catalogID >= 3910000 && catalogID <= 3919999;
|
||||
}
|
||||
|
||||
public bool IsArrowWeapon()
|
||||
{
|
||||
return catalogID >= 3920000 && catalogID <= 3929999;
|
||||
}
|
||||
|
||||
public bool IsBulletWeapon()
|
||||
{
|
||||
return catalogID >= 3930000 && catalogID <= 3939999;
|
||||
}
|
||||
|
||||
public bool IsShieldWeapon()
|
||||
{
|
||||
return catalogID >= 4100000 && catalogID <= 4109999;
|
||||
}
|
||||
|
||||
public bool IsManualGuardShieldWeapon()
|
||||
{
|
||||
return IsShieldWeapon() && GetShieldGuardTime() != -1;
|
||||
}
|
||||
|
||||
public bool IsMagicWeapon()
|
||||
{
|
||||
return catalogID >= 5000000 && catalogID <= 5999999;
|
||||
}
|
||||
|
||||
public bool IsMysticWeapon()
|
||||
{
|
||||
return catalogID >= 5010000 && catalogID <= 5019999;
|
||||
}
|
||||
|
||||
public bool IsThaumaturgeWeapon()
|
||||
{
|
||||
return catalogID >= 5020000 && catalogID <= 5029999;
|
||||
}
|
||||
|
||||
public bool IsConjurerWeapon()
|
||||
{
|
||||
return catalogID >= 5030000 && catalogID <= 5039999;
|
||||
}
|
||||
|
||||
public bool IsArchanistWeapon()
|
||||
{
|
||||
return catalogID >= 5040000 && catalogID <= 5049999;
|
||||
}
|
||||
|
||||
public bool IsCraftWeapon()
|
||||
{
|
||||
return catalogID >= 6000000 && catalogID <= 6999999;
|
||||
}
|
||||
|
||||
public bool IsCarpenterWeapon()
|
||||
{
|
||||
return catalogID >= 6010000 && catalogID <= 6019999;
|
||||
}
|
||||
|
||||
public bool IsBlackSmithWeapon()
|
||||
{
|
||||
return catalogID >= 6020000 && catalogID <= 6029999;
|
||||
}
|
||||
|
||||
public bool IsArmorerWeapon()
|
||||
{
|
||||
return catalogID >= 6030000 && catalogID <= 6039999;
|
||||
}
|
||||
|
||||
public bool IsGoldSmithWeapon()
|
||||
{
|
||||
return catalogID >= 6040000 && catalogID <= 6049999;
|
||||
}
|
||||
|
||||
public bool IsTannerWeapon()
|
||||
{
|
||||
return catalogID >= 6050000 && catalogID <= 6059999;
|
||||
}
|
||||
|
||||
public bool IsWeaverWeapon()
|
||||
{
|
||||
return catalogID >= 6060000 && catalogID <= 6069999;
|
||||
}
|
||||
|
||||
public bool IsAlchemistWeapon()
|
||||
{
|
||||
return catalogID >= 6070000 && catalogID <= 6079999;
|
||||
}
|
||||
|
||||
public bool IsCulinarianWeapon()
|
||||
{
|
||||
return catalogID >= 6080000 && catalogID <= 6089999;
|
||||
}
|
||||
|
||||
public bool IsHarvestWeapon()
|
||||
{
|
||||
return catalogID >= 7000000 && catalogID <= 7999999;
|
||||
}
|
||||
|
||||
public bool IsMinerWeapon()
|
||||
{
|
||||
return catalogID >= 7010000 && catalogID <= 7019999;
|
||||
}
|
||||
|
||||
public bool IsBotanistWeapon()
|
||||
{
|
||||
return catalogID >= 7020000 && catalogID <= 7029999;
|
||||
}
|
||||
|
||||
public bool IsFishingWeapon()
|
||||
{
|
||||
return catalogID >= 7030000 && catalogID <= 7039999;
|
||||
}
|
||||
|
||||
public bool IsShepherdWeapon()
|
||||
{
|
||||
return catalogID >= 7040000 && catalogID <= 7049999;
|
||||
}
|
||||
|
||||
public bool IsFishingBaitWeapon()
|
||||
{
|
||||
return catalogID >= 3940000 && catalogID <= 3949999;
|
||||
}
|
||||
|
||||
public bool IsFishingLureWeapon()
|
||||
{
|
||||
return catalogID >= 3940100 && catalogID <= 3940199;
|
||||
}
|
||||
|
||||
public bool IsArmor()
|
||||
{
|
||||
return catalogID >= 8000000 && catalogID <= 8999999;
|
||||
}
|
||||
|
||||
public static bool IsArmor(uint catalogID)
|
||||
{
|
||||
return catalogID >= 8000000 && catalogID <= 8999999;
|
||||
}
|
||||
|
||||
public bool IsAccessory()
|
||||
{
|
||||
return catalogID >= 9000000 && catalogID <= 9079999;
|
||||
}
|
||||
|
||||
public static bool IsAccessory(uint catalogID)
|
||||
{
|
||||
return catalogID >= 9000000 && catalogID <= 9079999;
|
||||
}
|
||||
|
||||
public bool IsAmulet()
|
||||
{
|
||||
return catalogID >= 9080000 && catalogID <= 9089999;
|
||||
}
|
||||
|
||||
public bool IsEnchantMateria()
|
||||
{
|
||||
return catalogID >= 10100000 && catalogID <= 10199999;
|
||||
}
|
||||
|
||||
public bool IsMaterial()
|
||||
{
|
||||
return catalogID >= 10000000 && catalogID <= 10999999;
|
||||
}
|
||||
|
||||
public bool IsEventItem()
|
||||
{
|
||||
return catalogID >= 11000000 && catalogID <= 15000000;
|
||||
}
|
||||
|
||||
public bool IsUseForBattle()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsHostilityItem()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsUsable()
|
||||
{
|
||||
return isUseable != 0;
|
||||
}
|
||||
|
||||
public bool IsUseFree()
|
||||
{
|
||||
return isUseable == -1;
|
||||
}
|
||||
|
||||
public bool IsLostAfterUsed()
|
||||
{
|
||||
return !IsEquipment();
|
||||
}
|
||||
|
||||
public int GetShieldGuardTime()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public Double GetItemHQValue(float value1, float value2)
|
||||
{
|
||||
return Math.Max(value1 + 1, Math.Ceiling(value1 * value2));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
class EquipmentItem : ItemData
|
||||
{
|
||||
//graphics
|
||||
public readonly uint graphicsWeaponId;
|
||||
public readonly uint graphicsEquipmentId;
|
||||
public readonly uint graphicsVariantId;
|
||||
public readonly uint graphicsColorId;
|
||||
|
||||
//equipment sheet
|
||||
public readonly int equipPoint;
|
||||
public readonly short equipTribe;
|
||||
|
||||
public readonly int paramBonusType1;
|
||||
public readonly short paramBonusValue1;
|
||||
public readonly int paramBonusType2;
|
||||
public readonly short paramBonusValue2;
|
||||
public readonly int paramBonusType3;
|
||||
public readonly short paramBonusValue3;
|
||||
public readonly int paramBonusType4;
|
||||
public readonly short paramBonusValue4;
|
||||
public readonly int paramBonusType5;
|
||||
public readonly short paramBonusValue5;
|
||||
public readonly int paramBonusType6;
|
||||
public readonly short paramBonusValue6;
|
||||
public readonly int paramBonusType7;
|
||||
public readonly short paramBonusValue7;
|
||||
public readonly int paramBonusType8;
|
||||
public readonly short paramBonusValue8;
|
||||
public readonly int paramBonusType9;
|
||||
public readonly short paramBonusValue9;
|
||||
public readonly int paramBonusType10;
|
||||
public readonly short paramBonusValue10;
|
||||
|
||||
public readonly short AdditionalEffect;
|
||||
public readonly bool materialBindPermission;
|
||||
public readonly short materializeTable;
|
||||
|
||||
public EquipmentItem(MySqlDataReader reader)
|
||||
: base (reader)
|
||||
{
|
||||
if (!reader.IsDBNull(reader.GetOrdinal("weaponId")) && !reader.IsDBNull(reader.GetOrdinal("equipmentId")) && !reader.IsDBNull(reader.GetOrdinal("variantId")) && !reader.IsDBNull(reader.GetOrdinal("colorId")))
|
||||
{
|
||||
graphicsWeaponId = reader.GetUInt32("weaponId");
|
||||
graphicsEquipmentId = reader.GetUInt32("equipmentId");
|
||||
graphicsVariantId = reader.GetUInt32("variantId");
|
||||
graphicsColorId = reader.GetUInt32("colorId");
|
||||
}
|
||||
|
||||
equipPoint = reader.GetInt32("equipPoint");
|
||||
equipTribe = reader.GetInt16("equipTribe");
|
||||
|
||||
paramBonusType1 = reader.GetInt32("paramBonusType1");
|
||||
paramBonusValue1 = reader.GetInt16("paramBonusValue1");
|
||||
paramBonusType2 = reader.GetInt32("paramBonusType2");
|
||||
paramBonusValue2 = reader.GetInt16("paramBonusValue2");
|
||||
paramBonusType3 = reader.GetInt32("paramBonusType3");
|
||||
paramBonusValue3 = reader.GetInt16("paramBonusValue3");
|
||||
paramBonusType4 = reader.GetInt32("paramBonusType4");
|
||||
paramBonusValue4 = reader.GetInt16("paramBonusValue4");
|
||||
paramBonusType5 = reader.GetInt32("paramBonusType5");
|
||||
paramBonusValue5 = reader.GetInt16("paramBonusValue5");
|
||||
paramBonusType6 = reader.GetInt32("paramBonusType6");
|
||||
paramBonusValue6 = reader.GetInt16("paramBonusValue6");
|
||||
paramBonusType7 = reader.GetInt32("paramBonusType7");
|
||||
paramBonusValue7 = reader.GetInt16("paramBonusValue7");
|
||||
paramBonusType8 = reader.GetInt32("paramBonusType8");
|
||||
paramBonusValue8 = reader.GetInt16("paramBonusValue8");
|
||||
paramBonusType9 = reader.GetInt32("paramBonusType9");
|
||||
paramBonusValue9 = reader.GetInt16("paramBonusValue9");
|
||||
paramBonusType10 = reader.GetInt32("paramBonusType10");
|
||||
paramBonusValue10 = reader.GetInt16("paramBonusValue10");
|
||||
|
||||
AdditionalEffect = reader.GetInt16("additionalEffect");
|
||||
materialBindPermission = reader.GetBoolean("materiaBindPermission");
|
||||
materializeTable = reader.GetInt16("materializeTable");
|
||||
}
|
||||
}
|
||||
|
||||
class WeaponItem : EquipmentItem
|
||||
{
|
||||
//extra graphics
|
||||
public readonly uint graphicsOffhandWeaponId;
|
||||
public readonly uint graphicsOffhandEquipmentId;
|
||||
public readonly uint graphicsOffhandVariantId;
|
||||
|
||||
//weapon sheet
|
||||
public readonly short attack;
|
||||
public readonly short magicAttack;
|
||||
public readonly short craftProcessing;
|
||||
public readonly short craftMagicProcessing;
|
||||
public readonly short harvestPotency;
|
||||
public readonly short harvestLimit;
|
||||
public readonly byte frequency; // hit count, 2 for h2h weapons
|
||||
public readonly short rate;
|
||||
public readonly short magicRate;
|
||||
public readonly short craftProcessControl;
|
||||
public readonly short harvestRate;
|
||||
public readonly short critical;
|
||||
public readonly short magicCritical;
|
||||
public readonly short parry;
|
||||
|
||||
public readonly int damageAttributeType1; // 1 slashing, 2 piercing, 3 blunt, 4 projectile
|
||||
public readonly float damageAttributeValue1;
|
||||
public readonly int damageAttributeType2;
|
||||
public readonly float damageAttributeValue2;
|
||||
public readonly int damageAttributeType3;
|
||||
public readonly float damageAttributeValue3;
|
||||
|
||||
public readonly short damagePower;
|
||||
public readonly float damageInterval;
|
||||
public readonly short ammoVirtualDamagePower;
|
||||
public readonly float dps;
|
||||
|
||||
public WeaponItem(MySqlDataReader reader)
|
||||
: base(reader)
|
||||
{
|
||||
if (!reader.IsDBNull(reader.GetOrdinal("offHandWeaponId")) && !reader.IsDBNull(reader.GetOrdinal("offHandEquipmentId")) && !reader.IsDBNull(reader.GetOrdinal("offHandVarientId")))
|
||||
{
|
||||
graphicsOffhandWeaponId = reader.GetUInt32("offHandWeaponId");
|
||||
graphicsOffhandEquipmentId = reader.GetUInt32("offHandEquipmentId");
|
||||
graphicsOffhandVariantId = reader.GetUInt32("offHandVarientId");
|
||||
}
|
||||
|
||||
attack = reader.GetInt16("attack");
|
||||
magicAttack = reader.GetInt16("magicAttack");
|
||||
craftProcessing = reader.GetInt16("craftProcessing");
|
||||
craftMagicProcessing = reader.GetInt16("craftMagicProcessing");
|
||||
harvestPotency = reader.GetInt16("harvestPotency");
|
||||
harvestLimit = reader.GetInt16("harvestLimit");
|
||||
frequency = reader.GetByte("frequency");
|
||||
rate = reader.GetInt16("rate");
|
||||
magicRate = reader.GetInt16("magicRate");
|
||||
craftProcessControl = reader.GetInt16("craftProcessControl");
|
||||
harvestRate = reader.GetInt16("harvestRate");
|
||||
critical = reader.GetInt16("critical");
|
||||
magicCritical = reader.GetInt16("magicCritical");
|
||||
parry = reader.GetInt16("parry");
|
||||
|
||||
damageAttributeType1 = reader.GetInt32("damageAttributeType1");
|
||||
damageAttributeValue1 = reader.GetFloat("damageAttributeValue1");
|
||||
damageAttributeType2 = reader.GetInt32("damageAttributeType2");
|
||||
damageAttributeValue2 = reader.GetFloat("damageAttributeValue2");
|
||||
damageAttributeType3 = reader.GetInt32("damageAttributeType3");
|
||||
damageAttributeValue3 = reader.GetFloat("damageAttributeValue3");
|
||||
|
||||
damagePower = reader.GetInt16("damagePower");
|
||||
damageInterval = reader.GetFloat("damageInterval");
|
||||
ammoVirtualDamagePower = reader.GetInt16("ammoVirtualDamagePower");
|
||||
dps = (damagePower + ammoVirtualDamagePower) / damageInterval;
|
||||
}
|
||||
}
|
||||
|
||||
class ArmorItem : EquipmentItem
|
||||
{
|
||||
//armor sheet
|
||||
public readonly short defense;
|
||||
public readonly short magicDefense;
|
||||
public readonly short criticalDefense;
|
||||
public readonly short evasion;
|
||||
public readonly short magicResistance;
|
||||
|
||||
public readonly int damageDefenseType1;
|
||||
public readonly short damageDefenseValue1;
|
||||
public readonly int damageDefenseType2;
|
||||
public readonly short damageDefenseValue2;
|
||||
public readonly int damageDefenseType3;
|
||||
public readonly short damageDefenseValue3;
|
||||
public readonly int damageDefenseType4;
|
||||
public readonly short damageDefenseValue4;
|
||||
|
||||
public ArmorItem(MySqlDataReader reader)
|
||||
: base(reader)
|
||||
{
|
||||
defense = reader.GetInt16("defense");
|
||||
magicDefense = reader.GetInt16("magicDefense");
|
||||
criticalDefense = reader.GetInt16("criticalDefense");
|
||||
evasion = reader.GetInt16("evasion");
|
||||
magicResistance = reader.GetInt16("magicResistance");
|
||||
|
||||
damageDefenseType1 = reader.GetInt32("damageDefenseType1");
|
||||
damageDefenseValue1 = reader.GetInt16("damageDefenseValue1");
|
||||
damageDefenseType2 = reader.GetInt32("damageDefenseType2");
|
||||
damageDefenseValue2 = reader.GetInt16("damageDefenseValue2");
|
||||
damageDefenseType3 = reader.GetInt32("damageDefenseType3");
|
||||
damageDefenseValue3 = reader.GetInt16("damageDefenseValue3");
|
||||
damageDefenseType4 = reader.GetInt32("damageDefenseType4");
|
||||
damageDefenseValue4 = reader.GetInt16("damageDefenseValue4");
|
||||
}
|
||||
}
|
||||
|
||||
class AccessoryItem : EquipmentItem
|
||||
{
|
||||
//accessory sheet
|
||||
public readonly byte power;
|
||||
public readonly byte size;
|
||||
|
||||
public AccessoryItem(MySqlDataReader reader)
|
||||
: base(reader)
|
||||
{
|
||||
power = reader.GetByte("power");
|
||||
size = reader.GetByte("size");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
41
Map Server/DataObjects/RecruitmentDetails.cs
Normal file
41
Map Server/DataObjects/RecruitmentDetails.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
===========================================================================
|
||||
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/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
namespace Meteor.Map.dataobjects
|
||||
{
|
||||
class RecruitmentDetails
|
||||
{
|
||||
public string recruiterName;
|
||||
public string comment;
|
||||
|
||||
public uint purposeId;
|
||||
public uint locationId;
|
||||
public uint subTaskId;
|
||||
public uint timeSinceStart;
|
||||
|
||||
public uint[] discipleId = new uint[4];
|
||||
public uint[] classjobId = new uint[4];
|
||||
public byte[] minLvl = new byte[4];
|
||||
public byte[] maxLvl = new byte[4];
|
||||
public byte[] num = new byte[4];
|
||||
|
||||
}
|
||||
}
|
51
Map Server/DataObjects/SeamlessBoundry.cs
Normal file
51
Map Server/DataObjects/SeamlessBoundry.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
===========================================================================
|
||||
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/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
namespace Meteor.Map.dataobjects
|
||||
{
|
||||
class SeamlessBoundry
|
||||
{
|
||||
public readonly uint regionId;
|
||||
public readonly uint zoneId1, zoneId2;
|
||||
public readonly float zone1_x1, zone1_y1, zone1_x2, zone1_y2;
|
||||
public readonly float zone2_x1, zone2_y1, zone2_x2, zone2_y2;
|
||||
public readonly float merge_x1, merge_y1, merge_x2, merge_y2;
|
||||
|
||||
public SeamlessBoundry(uint regionId, uint zoneId1, uint zoneId2, float zone1_x1, float zone1_y1, float zone1_x2, float zone1_y2, float zone2_x1, float zone2_y1, float zone2_x2, float zone2_y2, float merge_x1, float merge_y1, float merge_x2, float merge_y2)
|
||||
{
|
||||
this.regionId = regionId;
|
||||
this.zoneId1 = zoneId1;
|
||||
this.zoneId2 = zoneId2;
|
||||
this.zone1_x1 = zone1_x1;
|
||||
this.zone1_y1= zone1_y1;
|
||||
this.zone1_x2 = zone1_x2;
|
||||
this.zone1_y2 = zone1_y2;
|
||||
this.zone2_x1 = zone2_x1;
|
||||
this.zone2_y1 = zone2_y1;
|
||||
this.zone2_x2 = zone2_x2;
|
||||
this.zone2_y2 = zone2_y2;
|
||||
this.merge_x1 = merge_x1;
|
||||
this.merge_y1 = merge_y1;
|
||||
this.merge_x2 = merge_x2;
|
||||
this.merge_y2 = merge_y2;
|
||||
}
|
||||
}
|
||||
}
|
57
Map Server/DataObjects/SearchEntry.cs
Normal file
57
Map Server/DataObjects/SearchEntry.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
===========================================================================
|
||||
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 System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Meteor.Map.dataobjects
|
||||
{
|
||||
class SearchEntry
|
||||
{
|
||||
public ushort preferredClass;
|
||||
public ushort langauges;
|
||||
public ushort location;
|
||||
public ushort grandCompany;
|
||||
public ushort status;
|
||||
public ushort currentClass;
|
||||
public string name;
|
||||
public ushort[] classes = new ushort[2 * 20];
|
||||
public ushort[] jobs = new ushort[8];
|
||||
|
||||
public void WriteSearchEntry(BinaryWriter writer)
|
||||
{
|
||||
writer.Write((UInt16)preferredClass);
|
||||
writer.Write((UInt16)langauges);
|
||||
writer.Write((UInt16)location);
|
||||
writer.Write((UInt16)grandCompany);
|
||||
writer.Write((UInt16)status);
|
||||
writer.Write((UInt16)currentClass);
|
||||
|
||||
writer.Write(Encoding.ASCII.GetBytes(name), 0, Encoding.ASCII.GetByteCount(name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(name));
|
||||
|
||||
for (int i = 0; i < classes.Length; i++)
|
||||
writer.Write((UInt16)classes[i]);
|
||||
for (int i = 0; i < jobs.Length; i++)
|
||||
writer.Write((UInt16)jobs[i]);
|
||||
}
|
||||
}
|
||||
}
|
186
Map Server/DataObjects/Session.cs
Normal file
186
Map Server/DataObjects/Session.cs
Normal file
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
===========================================================================
|
||||
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.Common;
|
||||
|
||||
using Meteor.Map.Actors;
|
||||
using Meteor.Map.packets.send.actor;
|
||||
using System.Collections.Generic;
|
||||
using Meteor.Map.actors.chara.npc;
|
||||
|
||||
namespace Meteor.Map.dataobjects
|
||||
{
|
||||
class Session
|
||||
{
|
||||
public uint id = 0;
|
||||
Player playerActor;
|
||||
public List<Actor> actorInstanceList = new List<Actor>();
|
||||
public uint languageCode = 1;
|
||||
private uint lastPingPacket = Utils.UnixTimeStampUTC();
|
||||
|
||||
public bool isUpdatesLocked = true;
|
||||
|
||||
public string errorMessage = "";
|
||||
|
||||
public Session(uint sessionId)
|
||||
{
|
||||
this.id = sessionId;
|
||||
playerActor = new Player(this, sessionId);
|
||||
}
|
||||
|
||||
public void QueuePacket(List<SubPacket> packets)
|
||||
{
|
||||
foreach (SubPacket s in packets)
|
||||
QueuePacket(s);
|
||||
}
|
||||
|
||||
public void QueuePacket(SubPacket subPacket)
|
||||
{
|
||||
subPacket.SetTargetId(id);
|
||||
Server.GetWorldConnection().QueuePacket(subPacket);
|
||||
}
|
||||
|
||||
public Player GetActor()
|
||||
{
|
||||
return playerActor;
|
||||
}
|
||||
|
||||
public void Ping()
|
||||
{
|
||||
lastPingPacket = Utils.UnixTimeStampUTC();
|
||||
}
|
||||
|
||||
public bool CheckIfDCing()
|
||||
{
|
||||
uint currentTime = Utils.UnixTimeStampUTC();
|
||||
if (currentTime - lastPingPacket >= 5000) //Show D/C flag
|
||||
playerActor.SetDCFlag(true);
|
||||
else if (currentTime - lastPingPacket >= 30000) //DCed
|
||||
return true;
|
||||
else
|
||||
playerActor.SetDCFlag(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void UpdatePlayerActorPosition(float x, float y, float z, float rot, ushort moveState)
|
||||
{
|
||||
if (isUpdatesLocked)
|
||||
return;
|
||||
|
||||
if (playerActor.positionX == x && playerActor.positionY == y && playerActor.positionZ == z && playerActor.rotation == rot)
|
||||
return;
|
||||
|
||||
/*
|
||||
playerActor.oldPositionX = playerActor.positionX;
|
||||
playerActor.oldPositionY = playerActor.positionY;
|
||||
playerActor.oldPositionZ = playerActor.positionZ;
|
||||
playerActor.oldRotation = playerActor.rotation;
|
||||
|
||||
playerActor.positionX = x;
|
||||
playerActor.positionY = y;
|
||||
playerActor.positionZ = z;
|
||||
*/
|
||||
playerActor.rotation = rot;
|
||||
playerActor.moveState = moveState;
|
||||
|
||||
//GetActor().GetZone().UpdateActorPosition(GetActor());
|
||||
playerActor.QueuePositionUpdate(new Vector3(x,y,z));
|
||||
}
|
||||
|
||||
public void UpdateInstance(List<Actor> list)
|
||||
{
|
||||
if (isUpdatesLocked)
|
||||
return;
|
||||
|
||||
List<BasePacket> basePackets = new List<BasePacket>();
|
||||
List<SubPacket> RemoveActorSubpackets = new List<SubPacket>();
|
||||
List<SubPacket> posUpdateSubpackets = new List<SubPacket>();
|
||||
|
||||
//Remove missing actors
|
||||
for (int i = 0; i < actorInstanceList.Count; i++)
|
||||
{
|
||||
//Retainer Instance
|
||||
if (actorInstanceList[i] is Retainer && playerActor.currentSpawnedRetainer == null)
|
||||
{
|
||||
QueuePacket(RemoveActorPacket.BuildPacket(actorInstanceList[i].actorId));
|
||||
actorInstanceList.RemoveAt(i);
|
||||
}
|
||||
else if (!list.Contains(actorInstanceList[i]) && !(actorInstanceList[i] is Retainer))
|
||||
{
|
||||
QueuePacket(RemoveActorPacket.BuildPacket(actorInstanceList[i].actorId));
|
||||
actorInstanceList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
//Retainer Instance
|
||||
if (playerActor.currentSpawnedRetainer != null && !playerActor.sentRetainerSpawn)
|
||||
{
|
||||
Actor actor = playerActor.currentSpawnedRetainer;
|
||||
QueuePacket(actor.GetSpawnPackets(playerActor, 1));
|
||||
QueuePacket(actor.GetInitPackets());
|
||||
QueuePacket(actor.GetSetEventStatusPackets());
|
||||
actorInstanceList.Add(actor);
|
||||
((Npc)actor).DoOnActorSpawn(playerActor);
|
||||
playerActor.sentRetainerSpawn = true;
|
||||
}
|
||||
|
||||
//Add new actors or move
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
Actor actor = list[i];
|
||||
|
||||
if (actor.actorId == playerActor.actorId)
|
||||
continue;
|
||||
|
||||
if (actorInstanceList.Contains(actor))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
QueuePacket(actor.GetSpawnPackets(playerActor, 1));
|
||||
|
||||
QueuePacket(actor.GetInitPackets());
|
||||
QueuePacket(actor.GetSetEventStatusPackets());
|
||||
actorInstanceList.Add(actor);
|
||||
|
||||
if (actor is Npc)
|
||||
{
|
||||
((Npc)actor).DoOnActorSpawn(playerActor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void ClearInstance()
|
||||
{
|
||||
actorInstanceList.Clear();
|
||||
}
|
||||
|
||||
|
||||
public void LockUpdates(bool f)
|
||||
{
|
||||
isUpdatesLocked = f;
|
||||
}
|
||||
}
|
||||
}
|
24
Map Server/DataObjects/TradeTransaction.cs
Normal file
24
Map Server/DataObjects/TradeTransaction.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
===========================================================================
|
||||
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/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
namespace Meteor.Map.dataobjects
|
||||
{
|
||||
}
|
90
Map Server/DataObjects/ZoneConnection.cs
Normal file
90
Map Server/DataObjects/ZoneConnection.cs
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
===========================================================================
|
||||
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 System;
|
||||
using System.Net.Sockets;
|
||||
|
||||
using Meteor.Common;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Net;
|
||||
using Meteor.Map.packets.WorldPackets.Send;
|
||||
|
||||
namespace Meteor.Map.dataobjects
|
||||
{
|
||||
class ZoneConnection
|
||||
{
|
||||
//Connection stuff
|
||||
public Socket socket;
|
||||
public byte[] buffer;
|
||||
private BlockingCollection<SubPacket> SendPacketQueue = new BlockingCollection<SubPacket>(1000);
|
||||
public int lastPartialSize = 0;
|
||||
|
||||
public void QueuePacket(SubPacket subpacket)
|
||||
{
|
||||
if (SendPacketQueue.Count == SendPacketQueue.BoundedCapacity - 1)
|
||||
FlushQueuedSendPackets();
|
||||
|
||||
SendPacketQueue.Add(subpacket);
|
||||
}
|
||||
|
||||
public void FlushQueuedSendPackets()
|
||||
{
|
||||
if (socket == null || !socket.Connected)
|
||||
return;
|
||||
|
||||
while (SendPacketQueue.Count > 0)
|
||||
{
|
||||
SubPacket packet = SendPacketQueue.Take();
|
||||
|
||||
byte[] packetBytes = packet.GetBytes();
|
||||
|
||||
try
|
||||
{
|
||||
socket.Send(packetBytes);
|
||||
}
|
||||
catch (Exception e)
|
||||
{ Program.Log.Error(e, "Weird case, socket was d/ced: {0}"); }
|
||||
}
|
||||
}
|
||||
|
||||
public String GetAddress()
|
||||
{
|
||||
return String.Format("{0}:{1}", (socket.RemoteEndPoint as IPEndPoint).Address, (socket.RemoteEndPoint as IPEndPoint).Port);
|
||||
}
|
||||
|
||||
public bool IsConnected()
|
||||
{
|
||||
return (socket.Poll(1, SelectMode.SelectRead) && socket.Available == 0);
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
if (socket.Connected)
|
||||
socket.Disconnect(false);
|
||||
}
|
||||
|
||||
public void RequestZoneChange(uint sessionId, uint destinationZoneId, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
|
||||
{
|
||||
WorldRequestZoneChangePacket.BuildPacket(sessionId, destinationZoneId, spawnType, spawnX, spawnY, spawnZ, spawnRotation).DebugPrintSubPacket();
|
||||
QueuePacket(WorldRequestZoneChangePacket.BuildPacket(sessionId, destinationZoneId, spawnType, spawnX, spawnY, spawnZ, spawnRotation));
|
||||
}
|
||||
}
|
||||
}
|
41
Map Server/DataObjects/database/DBWorld.cs
Normal file
41
Map Server/DataObjects/database/DBWorld.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
===========================================================================
|
||||
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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Lobby_Server.dataobjects
|
||||
{
|
||||
class DBWorld
|
||||
{
|
||||
public ushort id;
|
||||
public string address;
|
||||
public ushort port;
|
||||
public ushort listPosition;
|
||||
public ushort population;
|
||||
public string name;
|
||||
public bool isActive;
|
||||
public string motd;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue