mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-22 12:47:46 +00:00
Merge branch 'develop' of https://bitbucket.org/Ioncannon/ffxiv-classic-server into develop
This commit is contained in:
commit
63ac56224e
15 changed files with 197 additions and 28 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace FFXIVClassic.Common
|
||||
|
@ -13,7 +14,7 @@ namespace FFXIVClassic.Common
|
|||
for (var i = 0; i < 256; i++)
|
||||
{
|
||||
var s = i.ToString("X2");
|
||||
result[i] = s[0] + ((uint) s[1] << 16);
|
||||
result[i] = s[0] + ((uint)s[1] << 16);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -28,13 +29,13 @@ namespace FFXIVClassic.Common
|
|||
var hexChars = "0123456789ABCDEF".ToCharArray();
|
||||
|
||||
var offsetBlock = 8 + 3;
|
||||
var byteBlock = offsetBlock + bytesPerLine*3 + (bytesPerLine - 1)/8 + 2;
|
||||
var byteBlock = offsetBlock + bytesPerLine * 3 + (bytesPerLine - 1) / 8 + 2;
|
||||
var lineLength = byteBlock + bytesPerLine + Environment.NewLine.Length;
|
||||
|
||||
var line = (new string(' ', lineLength - Environment.NewLine.Length) + Environment.NewLine).ToCharArray();
|
||||
var numLines = (bytes.Length + bytesPerLine - 1)/bytesPerLine;
|
||||
var numLines = (bytes.Length + bytesPerLine - 1) / bytesPerLine;
|
||||
|
||||
var sb = new StringBuilder(numLines*lineLength);
|
||||
var sb = new StringBuilder(numLines * lineLength);
|
||||
|
||||
for (var i = 0; i < bytes.Length; i += bytesPerLine)
|
||||
{
|
||||
|
@ -70,7 +71,7 @@ namespace FFXIVClassic.Common
|
|||
var by = bytes[i + j];
|
||||
line[hexColumn] = hexChars[(by >> 4) & 0xF];
|
||||
line[hexColumn + 1] = hexChars[by & 0xF];
|
||||
line[charColumn] = by < 32 ? '.' : (char) by;
|
||||
line[charColumn] = by < 32 ? '.' : (char)by;
|
||||
}
|
||||
|
||||
hexColumn += 3;
|
||||
|
@ -89,7 +90,7 @@ namespace FFXIVClassic.Common
|
|||
var currentTime = DateTime.Now;
|
||||
var zuluTime = currentTime.ToUniversalTime();
|
||||
var unixEpoch = new DateTime(1970, 1, 1);
|
||||
unixTimeStamp = (uint) zuluTime.Subtract(unixEpoch).TotalSeconds;
|
||||
unixTimeStamp = (uint)zuluTime.Subtract(unixEpoch).TotalSeconds;
|
||||
|
||||
return unixTimeStamp;
|
||||
}
|
||||
|
@ -100,7 +101,7 @@ namespace FFXIVClassic.Common
|
|||
var currentTime = DateTime.Now;
|
||||
var zuluTime = currentTime.ToUniversalTime();
|
||||
var unixEpoch = new DateTime(1970, 1, 1);
|
||||
unixTimeStamp = (ulong) zuluTime.Subtract(unixEpoch).TotalMilliseconds;
|
||||
unixTimeStamp = (ulong)zuluTime.Subtract(unixEpoch).TotalMilliseconds;
|
||||
|
||||
return unixTimeStamp;
|
||||
}
|
||||
|
@ -127,7 +128,7 @@ namespace FFXIVClassic.Common
|
|||
|
||||
public static int SwapEndian(int input)
|
||||
{
|
||||
var inputAsUint = (uint) input;
|
||||
var inputAsUint = (uint)input;
|
||||
|
||||
input = (int)
|
||||
(((inputAsUint >> 24) & 0xff) |
|
||||
|
@ -151,7 +152,7 @@ namespace FFXIVClassic.Common
|
|||
|
||||
// Initialize the hash to a 'random' value
|
||||
|
||||
var h = seed ^ (uint) len;
|
||||
var h = seed ^ (uint)len;
|
||||
|
||||
// Mix 4 bytes at a time into the hash
|
||||
|
||||
|
@ -160,7 +161,7 @@ namespace FFXIVClassic.Common
|
|||
{
|
||||
h *= m;
|
||||
|
||||
var k = (uint) BitConverter.ToInt32(data, dataIndex);
|
||||
var k = (uint)BitConverter.ToInt32(data, dataIndex);
|
||||
k = ((k >> 24) & 0xff) | // move byte 3 to byte 0
|
||||
((k << 8) & 0xff0000) | // move byte 1 to byte 2
|
||||
((k >> 8) & 0xff00) | // move byte 2 to byte 1
|
||||
|
@ -180,10 +181,10 @@ namespace FFXIVClassic.Common
|
|||
switch (len)
|
||||
{
|
||||
case 3:
|
||||
h ^= (uint) data[0] << 16;
|
||||
h ^= (uint)data[0] << 16;
|
||||
goto case 2;
|
||||
case 2:
|
||||
h ^= (uint) data[len - 2] << 8;
|
||||
h ^= (uint)data[len - 2] << 8;
|
||||
goto case 1;
|
||||
case 1:
|
||||
h ^= data[len - 1];
|
||||
|
@ -204,7 +205,7 @@ namespace FFXIVClassic.Common
|
|||
|
||||
public static byte[] ConvertBoolArrayToBinaryStream(bool[] array)
|
||||
{
|
||||
var data = new byte[array.Length/8 + (array.Length%8 != 0 ? 1 : 0)];
|
||||
var data = new byte[array.Length / 8 + (array.Length % 8 != 0 ? 1 : 0)];
|
||||
|
||||
var dataCounter = 0;
|
||||
for (var i = 0; i < array.Length; i += 8)
|
||||
|
@ -213,7 +214,7 @@ namespace FFXIVClassic.Common
|
|||
{
|
||||
if (i + bitCount >= array.Length)
|
||||
break;
|
||||
data[dataCounter] = (byte) (((array[i + bitCount] ? 1 : 0) << 7 - bitCount) | data[dataCounter]);
|
||||
data[dataCounter] = (byte)(((array[i + bitCount] ? 1 : 0) << 7 - bitCount) | data[dataCounter]);
|
||||
}
|
||||
dataCounter++;
|
||||
}
|
||||
|
@ -225,10 +226,130 @@ namespace FFXIVClassic.Common
|
|||
{
|
||||
var lookup = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
var secondDigit = lookup.Substring((int) Math.Floor(number/(double) lookup.Length), 1);
|
||||
var firstDigit = lookup.Substring(number%lookup.Length, 1);
|
||||
var secondDigit = lookup.Substring((int)Math.Floor(number / (double)lookup.Length), 1);
|
||||
var firstDigit = lookup.Substring(number % lookup.Length, 1);
|
||||
|
||||
return secondDigit + firstDigit;
|
||||
}
|
||||
|
||||
|
||||
public static string FFXIVLoginStringDecodeBinary(string path)
|
||||
{
|
||||
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
||||
byte[] data = File.ReadAllBytes(path);
|
||||
int offset = 0x5405a;
|
||||
//int offset = 0x5425d;
|
||||
//int offset = 0x53ea0;
|
||||
while (true)
|
||||
{
|
||||
string result = "";
|
||||
uint key = (uint)data[offset + 0] << 8 | data[offset + 1];
|
||||
uint key2 = data[offset + 2];
|
||||
key = RotateRight(key, 1) & 0xFFFF;
|
||||
key -= 0x22AF;
|
||||
key &= 0xFFFF;
|
||||
key2 = key2 ^ key;
|
||||
key = RotateRight(key, 1) & 0xFFFF;
|
||||
key -= 0x22AF;
|
||||
key &= 0xFFFF;
|
||||
uint finalKey = key;
|
||||
key = data[offset + 3];
|
||||
uint count = (key2 & 0xFF) << 8;
|
||||
key = key ^ finalKey;
|
||||
key &= 0xFF;
|
||||
count |= key;
|
||||
|
||||
int count2 = 0;
|
||||
while (count != 0)
|
||||
{
|
||||
uint encrypted = data[offset + 4 + count2];
|
||||
finalKey = RotateRight(finalKey, 1) & 0xFFFF;
|
||||
finalKey -= 0x22AF;
|
||||
finalKey &= 0xFFFF;
|
||||
encrypted = encrypted ^ (finalKey & 0xFF);
|
||||
|
||||
result += (char)encrypted;
|
||||
count--;
|
||||
count2++;
|
||||
}
|
||||
|
||||
offset += 4 + count2;
|
||||
}
|
||||
}
|
||||
|
||||
public static string FFXIVLoginStringDecode(byte[] data)
|
||||
{
|
||||
string result = "";
|
||||
uint key = (uint)data[0] << 8 | data[1];
|
||||
uint key2 = data[2];
|
||||
key = RotateRight(key, 1) & 0xFFFF;
|
||||
key -= 0x22AF;
|
||||
key2 = key2 ^ key;
|
||||
key = RotateRight(key, 1) & 0xFFFF;
|
||||
key -= 0x22AF;
|
||||
uint finalKey = key;
|
||||
key = data[3];
|
||||
uint count = (key2 & 0xFF) << 8;
|
||||
key = key ^ finalKey;
|
||||
key &= 0xFF;
|
||||
count |= key;
|
||||
|
||||
int count2 = 0;
|
||||
while (count != 0)
|
||||
{
|
||||
uint encrypted = data[4 + count2];
|
||||
finalKey = RotateRight(finalKey, 1) & 0xFFFF;
|
||||
finalKey -= 0x22AF;
|
||||
encrypted = encrypted ^ (finalKey & 0xFF);
|
||||
result += (char)encrypted;
|
||||
count--;
|
||||
count2++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte[] FFXIVLoginStringEncode(uint key, string text)
|
||||
{
|
||||
key = key & 0xFFFF;
|
||||
|
||||
uint count = 0;
|
||||
byte[] asciiBytes = Encoding.ASCII.GetBytes(text);
|
||||
byte[] result = new byte[4 + text.Length];
|
||||
for (count = 0; count < text.Length; count++)
|
||||
{
|
||||
result[result.Length - count - 1] = (byte)(asciiBytes[asciiBytes.Length - count - 1] ^ (key & 0xFF));
|
||||
key += 0x22AF;
|
||||
key &= 0xFFFF;
|
||||
key = RotateLeft(key, 1) & 0xFFFF;
|
||||
}
|
||||
|
||||
count = count ^ key;
|
||||
result[3] = (byte)(count & 0xFF);
|
||||
|
||||
key += 0x22AF & 0xFFFF;
|
||||
key = RotateLeft(key, 1) & 0xFFFF;
|
||||
|
||||
result[2] = (byte)(key & 0xFF);
|
||||
|
||||
key += 0x22AF & 0xFFFF;
|
||||
key = RotateLeft(key, 1) & 0xFFFF;
|
||||
|
||||
|
||||
result[1] = (byte)(key & 0xFF);
|
||||
result[0] = (byte)((key >> 8) & 0xFF);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint RotateLeft(uint value, int bits)
|
||||
{
|
||||
return (value << bits) | (value >> (16 - bits));
|
||||
}
|
||||
|
||||
public static uint RotateRight(uint value, int bits)
|
||||
{
|
||||
return (value >> bits) | (value << (16 - bits));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -88,7 +88,7 @@ namespace FFXIVClassic_Map_Server
|
|||
if (cmd.Any())
|
||||
{
|
||||
// if client isnt null, take player to be the player actor
|
||||
var player = client.GetActor();
|
||||
var player = client?.GetActor();
|
||||
|
||||
if (cmd.Equals("help"))
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
<!-- add your logging rules here -->
|
||||
<logger name='*' minlevel='Trace' writeTo='file' />
|
||||
<logger name='FFXIVClassic_Map_Server.Program' minlevel='Trace' writeTo='console' />
|
||||
<logger name='FFXIVClassic_Map_Server.lua.*' minlevel='Trace' writeTo='console' />
|
||||
<logger name='FFXIVClassic_Map_Server.packets.*' minlevel='Debug' writeTo='packets' />
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
|
|
|
@ -524,12 +524,10 @@ namespace FFXIVClassic_Map_Server
|
|||
//Moves actor to new zone, and sends packets to spawn at the given coords.
|
||||
public void DoZoneChange(Player player, uint destinationZoneId, string destinationPrivateArea, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
|
||||
{
|
||||
Area oldZone;
|
||||
|
||||
Area oldZone = player.zone;
|
||||
//Remove player from currentZone if transfer else it's login
|
||||
if (player.zone != null)
|
||||
{
|
||||
oldZone = player.zone;
|
||||
oldZone.RemoveActorFromZone(player);
|
||||
}
|
||||
|
||||
|
@ -540,9 +538,20 @@ namespace FFXIVClassic_Map_Server
|
|||
newArea = GetZone(destinationZoneId);
|
||||
else
|
||||
newArea = GetZone(destinationZoneId).GetPrivateArea(destinationPrivateArea, 0);
|
||||
|
||||
//This server does not contain that zoneId
|
||||
if (newArea == null)
|
||||
{
|
||||
if (oldZone != null)
|
||||
{
|
||||
oldZone.AddActorToZone(player);
|
||||
}
|
||||
|
||||
var message = "WorldManager.DoZoneChange: unable to change areas, new area is not valid.";
|
||||
player.SendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM, "[Debug]", message);
|
||||
Program.Log.Debug(message);
|
||||
return;
|
||||
}
|
||||
|
||||
newArea.AddActorToZone(player);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ properties = {
|
|||
[[
|
||||
<zone> |
|
||||
<zone> <x> <y> <z> |
|
||||
<x> <y> <z> <zone> <privateArea> <target name>.
|
||||
<zone> <x> <y> <z> <privateArea> <target name>.
|
||||
]],
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
-- Table structure for table `gamedata_achievements`
|
||||
--
|
||||
|
||||
SET autocommit = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `gamedata_achievements`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
|
@ -795,4 +797,6 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- Dump completed on 2016-06-07 22:54:49
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
-- Table structure for table `gamedata_actor_appearance`
|
||||
--
|
||||
|
||||
SET autocommit = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `gamedata_actor_appearance`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
|
@ -7916,4 +7918,6 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- Dump completed on 2016-06-07 22:54:50
|
||||
|
|
|
@ -8,6 +8,8 @@ Date: 6/21/2016 10:49:37 PM
|
|||
*/
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
SET autocommit = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for gamedata_actor_class
|
||||
-- ----------------------------
|
||||
|
@ -8006,3 +8008,5 @@ INSERT INTO `gamedata_actor_class` VALUES ('9220405', '', '2', null);
|
|||
INSERT INTO `gamedata_actor_class` VALUES ('9220406', '', '2', null);
|
||||
INSERT INTO `gamedata_actor_class` VALUES ('9220407', '', '2', null);
|
||||
INSERT INTO `gamedata_actor_class` VALUES ('9220408', '', '2', null);
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
-- Table structure for table `gamedata_items`
|
||||
--
|
||||
|
||||
SET autocommit = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `gamedata_items`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
|
@ -8476,4 +8478,6 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- Dump completed on 2016-06-07 22:54:51
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
-- Table structure for table `gamedata_items_accessory`
|
||||
--
|
||||
|
||||
SET autocommit = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `gamedata_items_accessory`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
|
@ -326,4 +328,6 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- Dump completed on 2016-06-07 22:54:51
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
-- Table structure for table `gamedata_items_armor`
|
||||
--
|
||||
|
||||
SET autocommit = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `gamedata_items_armor`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
-- Table structure for table `gamedata_items_equipment`
|
||||
--
|
||||
|
||||
SET autocommit = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `gamedata_items_equipment`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
|
@ -4946,4 +4948,6 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- Dump completed on 2016-06-07 22:54:52
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
-- Table structure for table `gamedata_items_graphics`
|
||||
--
|
||||
|
||||
SET autocommit = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `gamedata_items_graphics`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
|
@ -144,4 +146,6 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- Dump completed on 2016-06-07 22:54:52
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
-- Table structure for table `gamedata_items_weapon`
|
||||
--
|
||||
|
||||
SET autocommit = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `gamedata_items_weapon`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
|
@ -1230,4 +1232,6 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- Dump completed on 2016-06-07 22:54:52
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
IMPORT_PATH=C:/repositories/ffxiv-classic-server/sql/
|
||||
IMPORT_PATH="C://coding//repositories//ffxiv related//ffxivclassic//ffxiv-classic-server//sql//"
|
||||
USER=root
|
||||
PASS=root
|
||||
DBNAME=ffxiv_server
|
||||
|
@ -8,14 +8,18 @@ ECHO Creating Database $DBNAME
|
|||
mysqladmin -h localhost -u $USER -p$PASS DROP $DBNAME
|
||||
|
||||
ECHO Creating Database $DBNAME
|
||||
mysqladmin -h localhost -u $USER -p$PASS CREATE $DBNAME
|
||||
mysqladmin -h localhost -u $USER -p$PASS CREATE $DBNAME IF NOT EXISTS $DBNAME
|
||||
|
||||
ECHO Loading $DBNAME tables into the database
|
||||
cd $IMPORT_PATH
|
||||
for X in *.sql;
|
||||
sh cd $IMPORT_PATH
|
||||
|
||||
for X in '*.sql';
|
||||
do
|
||||
echo Importing $X;
|
||||
"C:\program files\mysql\mysql server 5.7\bin\mysql" $DBNAME -h localhost -u $USER -p$PASS < $X
|
||||
for Y in $X
|
||||
do
|
||||
echo Importing $Y;
|
||||
"C:\program files\mysql\mysql server 5.7\bin\mysql" $DBNAME -h localhost -u $USER -p$PASS < $Y
|
||||
done
|
||||
done
|
||||
|
||||
ECHO Finished!
|
Loading…
Add table
Reference in a new issue