mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-10 23:25:41 +12:00
Add Dress up Multiroom?
This commit is contained in:
parent
13435cf37f
commit
99c604e926
14 changed files with 420 additions and 47 deletions
DataCollection
Horse Isle Server/HorseIsleServer
WebInterface/game-site
|
@ -808,7 +808,7 @@
|
|||
}
|
||||
},
|
||||
"multiroom":{
|
||||
"other_players_participating":"<BR>^LThe following other players are participating:",
|
||||
"other_players_participating":"^LThe following other players are participating:",
|
||||
"partcipent_format":"^R1^T3%USERNAME%"
|
||||
},
|
||||
"bank":{
|
||||
|
|
|
@ -307,13 +307,32 @@ namespace HISP.Game
|
|||
{
|
||||
|
||||
string message = Messages.MultiroomPlayersParticipating;
|
||||
foreach (User userOnTile in GameServer.GetUsersOnSpecialTileCode("MULTIROOM-" + id))
|
||||
if(id != null) // Special type
|
||||
{
|
||||
if (userOnTile.Id == user.Id)
|
||||
continue;
|
||||
message += Messages.FormatMultiroomParticipent(userOnTile.Username);
|
||||
foreach (User userOnTile in GameServer.GetUsersOnSpecialTileCode("MULTIROOM-" + id))
|
||||
{
|
||||
if (userOnTile.Id == user.Id)
|
||||
continue;
|
||||
message += Messages.FormatMultiroomParticipent(userOnTile.Username);
|
||||
}
|
||||
message += Messages.R1;
|
||||
}
|
||||
if (id[0] == 'P') // Poet
|
||||
else if(id == null) // Generic
|
||||
{
|
||||
foreach (User userOnTile in GameServer.GetUsersAt(user.X, user.Y, true, true))
|
||||
{
|
||||
if (userOnTile.Id == user.Id)
|
||||
continue;
|
||||
message += Messages.FormatMultiroomParticipent(userOnTile.Username);
|
||||
}
|
||||
message += Messages.R1;
|
||||
}
|
||||
|
||||
if(id == null) // Generic
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
else if (id[0] == 'P') // Poet
|
||||
{
|
||||
int lastPoet = Database.GetLastPlayer(id);
|
||||
string username = "";
|
||||
|
@ -322,7 +341,7 @@ namespace HISP.Game
|
|||
|
||||
message += Messages.FormatLastPoet(username);
|
||||
}
|
||||
if (id[0] == 'D') // Drawning room
|
||||
else if (id[0] == 'D') // Drawning room
|
||||
{
|
||||
int lastDraw = Database.GetLastPlayer(id);
|
||||
string username = "";
|
||||
|
@ -2857,9 +2876,7 @@ namespace HISP.Game
|
|||
}
|
||||
if (TileCode == "MULTIROOM")
|
||||
{
|
||||
user.MetaPriority = false;
|
||||
if (TileArg != "")
|
||||
message += buildMultiroom(TileArg, user);
|
||||
message += buildMultiroom(TileArg != "" ? TileArg : null, user);
|
||||
}
|
||||
if (TileCode == "PASSWORD")
|
||||
{
|
||||
|
|
119
Horse Isle Server/HorseIsleServer/Game/SwfModules/Dressup.cs
Normal file
119
Horse Isle Server/HorseIsleServer/Game/SwfModules/Dressup.cs
Normal file
|
@ -0,0 +1,119 @@
|
|||
using HISP.Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HISP.Game.SwfModules
|
||||
{
|
||||
public class Dressup
|
||||
{
|
||||
|
||||
public static List<DressupRoom> DressupRooms = new List<DressupRoom>();
|
||||
public class DressupRoom
|
||||
{
|
||||
public DressupRoom(int roomId)
|
||||
{
|
||||
RoomId = roomId;
|
||||
DressupPeices = new List<DressupPeice>();
|
||||
|
||||
DressupPeice[] peices = Database.LoadDressupRoom(this);
|
||||
foreach (DressupPeice peice in peices)
|
||||
DressupPeices.Add(peice);
|
||||
|
||||
DressupRooms.Add(this);
|
||||
}
|
||||
public int RoomId;
|
||||
public List<DressupPeice> DressupPeices;
|
||||
|
||||
public DressupPeice GetDressupPeice(int peiceId)
|
||||
{
|
||||
foreach(DressupPeice peice in DressupPeices)
|
||||
{
|
||||
if (peice.PeiceId == peiceId)
|
||||
return peice;
|
||||
}
|
||||
// Else create peice
|
||||
DressupPeice dPeice = new DressupPeice(this, peiceId, 0, 0, false, true);
|
||||
DressupPeices.Add(dPeice);
|
||||
return dPeice;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class DressupPeice
|
||||
{
|
||||
public DressupPeice(DressupRoom room,int peiceId, int x, int y, bool active, bool createNew)
|
||||
{
|
||||
this.baseRoom = room;
|
||||
this.PeiceId = peiceId;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.active = active;
|
||||
|
||||
|
||||
if (createNew)
|
||||
Database.CreateDressupRoomPeice(room.RoomId, peiceId, active, x, y);
|
||||
|
||||
}
|
||||
public DressupRoom baseRoom;
|
||||
public int PeiceId;
|
||||
public int X
|
||||
{
|
||||
get
|
||||
{
|
||||
return x;
|
||||
}
|
||||
set
|
||||
{
|
||||
Database.SetDressupRoomPeiceX(baseRoom.RoomId, PeiceId, value);
|
||||
x = value;
|
||||
}
|
||||
}
|
||||
public int Y
|
||||
{
|
||||
get
|
||||
{
|
||||
return y;
|
||||
}
|
||||
set
|
||||
{
|
||||
Database.SetDressupRoomPeiceY(baseRoom.RoomId, PeiceId, value);
|
||||
y = value;
|
||||
}
|
||||
}
|
||||
public bool Active
|
||||
{
|
||||
get
|
||||
{
|
||||
return active;
|
||||
}
|
||||
set
|
||||
{
|
||||
Database.SetDressupRoomPeiceActive(baseRoom.RoomId, PeiceId, value);
|
||||
active = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private bool active;
|
||||
|
||||
}
|
||||
|
||||
public static DressupRoom GetDressupRoom(int roomId)
|
||||
{
|
||||
foreach(DressupRoom sRoom in DressupRooms)
|
||||
{
|
||||
if (sRoom.RoomId == roomId)
|
||||
return sRoom;
|
||||
}
|
||||
|
||||
// Else create room
|
||||
|
||||
DressupRoom room = new DressupRoom(roomId);
|
||||
return room;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ using HISP.Game.Inventory;
|
|||
using HISP.Game.Items;
|
||||
using HISP.Security;
|
||||
using HISP.Game.Services;
|
||||
using HISP.Game.SwfModules;
|
||||
|
||||
namespace HISP.Server
|
||||
{
|
||||
|
@ -42,6 +43,7 @@ namespace HISP.Server
|
|||
string PoetryRooms = "CREATE TABLE IF NOT EXISTS PoetryRooms(poetId INT, X INT, Y INT, roomId INT)";
|
||||
string SavedDrawings = "CREATE TABLE IF NOT EXISTS SavedDrawings(playerId INT, Drawing1 TEXT(65535), Drawing2 TEXT(65535), Drawing3 TEXT(65535))";
|
||||
string DrawingRooms = "CREATE TABLE IF NOT EXISTS DrawingRooms(roomId INT, Drawing TEXT(65535))";
|
||||
string DressupRooms = "CREATE TABLE IF NOT EXISTS DressupRooms(roomId INT, peiceId INT, active TEXT(3), x INT, y INT)";
|
||||
string Horses = "CREATE TABLE IF NOT EXISTS Horses(randomId INT, ownerId INT, leaseTime INT, leaser INT, breed INT, name TEXT(128), description TEXT(1028), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT, hidden TEXT(3))";
|
||||
string WildHorse = "CREATE TABLE IF NOT EXISTS WildHorse(randomId INT, originalOwner INT, breed INT, x INT, y INT, name TEXT(128), description TEXT(1028), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, timeout INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT)";
|
||||
string LastPlayer = "CREATE TABLE IF NOT EXISTS LastPlayer(roomId TEXT(1028), playerId INT)";
|
||||
|
@ -67,6 +69,19 @@ namespace HISP.Server
|
|||
Logger.WarnPrint(e.Message);
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = DressupRooms;
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.WarnPrint(e.Message);
|
||||
};
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
|
@ -509,6 +524,98 @@ namespace HISP.Server
|
|||
return count >= 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateDressupRoomPeice(int roomId, int peiceId, bool active, int x, int y)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "INSERT INTO DressupRooms VALUES(@roomId, @peiceId, @active, @x, @y)";
|
||||
sqlCommand.Parameters.AddWithValue("@roomId", roomId);
|
||||
sqlCommand.Parameters.AddWithValue("@peiceId", peiceId);
|
||||
sqlCommand.Parameters.AddWithValue("@active", active ? "YES" : "NO");
|
||||
sqlCommand.Parameters.AddWithValue("@x", x);
|
||||
sqlCommand.Parameters.AddWithValue("@y", y);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetDressupRoomPeiceX(int roomId, int peiceId, int newX)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE DressupRooms SET x=@x WHERE roomId=@roomId AND peiceId=@peiceId";
|
||||
sqlCommand.Parameters.AddWithValue("@roomId", roomId);
|
||||
sqlCommand.Parameters.AddWithValue("@peiceId", peiceId);
|
||||
sqlCommand.Parameters.AddWithValue("@x", newX);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetDressupRoomPeiceY(int roomId, int peiceId, int newY)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE DressupRooms SET y=@y WHERE roomId=@roomId AND peiceId=@peiceId";
|
||||
sqlCommand.Parameters.AddWithValue("@roomId", roomId);
|
||||
sqlCommand.Parameters.AddWithValue("@peiceId", peiceId);
|
||||
sqlCommand.Parameters.AddWithValue("@y", newY);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetDressupRoomPeiceActive(int roomId, int peiceId, bool active)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE DressupRooms SET active=@active WHERE roomId=@roomId AND peiceId=@peiceId";
|
||||
sqlCommand.Parameters.AddWithValue("@roomId", roomId);
|
||||
sqlCommand.Parameters.AddWithValue("@peiceId", peiceId);
|
||||
sqlCommand.Parameters.AddWithValue("@active", active ? "YES" : "NO");
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static Dressup.DressupPeice[] LoadDressupRoom(Dressup.DressupRoom room)
|
||||
{
|
||||
List<Dressup.DressupPeice> peices = new List<Dressup.DressupPeice>();
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "SELECT * FROM DressupRooms WHERE roomId=@roomId";
|
||||
sqlCommand.Parameters.AddWithValue("@roomId", room.RoomId);
|
||||
sqlCommand.Prepare();
|
||||
MySqlDataReader reader = sqlCommand.ExecuteReader();
|
||||
while(reader.Read())
|
||||
{
|
||||
int peiceId = reader.GetInt32(1);
|
||||
bool active = reader.GetString(2) == "YES";
|
||||
int x = reader.GetInt32(3);
|
||||
int y = reader.GetInt32(4);
|
||||
Dressup.DressupPeice peice = new Dressup.DressupPeice(room, peiceId, x, y, active, false);
|
||||
peices.Add(peice);
|
||||
}
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
return peices.ToArray();
|
||||
}
|
||||
|
||||
public static int[] GetSolvedRealTimeRiddles(int playerId)
|
||||
{
|
||||
List<int> solvedRiddleId = new List<int>();
|
||||
|
|
|
@ -3325,7 +3325,10 @@ namespace HISP.Server
|
|||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to load an invalid drawing room: " + roomId);
|
||||
break;
|
||||
|
||||
}
|
||||
UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y, true, sender.LoggedinUser);
|
||||
|
||||
if(room.Drawing != "")
|
||||
{
|
||||
byte[] drawingPacket = PacketBuilder.CreateDrawingUpdatePacket(room.Drawing);
|
||||
|
@ -3526,7 +3529,7 @@ namespace HISP.Server
|
|||
|
||||
int roomId = packet[3] - 40;
|
||||
Brickpoet.PoetryPeice[] room;
|
||||
try
|
||||
try // Make sure the room exists-
|
||||
{
|
||||
room = Brickpoet.GetPoetryRoom(roomId);
|
||||
}
|
||||
|
@ -3535,9 +3538,11 @@ namespace HISP.Server
|
|||
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to load an invalid brickpoet room: " + roomId);
|
||||
break;
|
||||
}
|
||||
|
||||
// Send list of peices
|
||||
byte[] poetPacket = PacketBuilder.CreateBrickPoetListPacket(room);
|
||||
sender.SendPacket(poetPacket);
|
||||
|
||||
UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y, true, sender.LoggedinUser);
|
||||
}
|
||||
else if(packet[3] == PacketBuilder.BRICKPOET_MOVE)
|
||||
{
|
||||
|
@ -3566,7 +3571,7 @@ namespace HISP.Server
|
|||
Brickpoet.PoetryPeice[] room;
|
||||
Brickpoet.PoetryPeice peice;
|
||||
|
||||
try
|
||||
try // Make sure these are acturally numbers!
|
||||
{
|
||||
peiceId = int.Parse(args[1]);
|
||||
x = int.Parse(args[2]);
|
||||
|
@ -3582,11 +3587,11 @@ namespace HISP.Server
|
|||
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to move a peice in an invalid brickpoet room: " + roomId);
|
||||
break;
|
||||
}
|
||||
|
||||
// Change location in Database
|
||||
peice.X = x;
|
||||
peice.Y = y;
|
||||
|
||||
foreach(User user in GetUsersOnSpecialTileCode("MULTIROOM-" + "P" + roomId.ToString()))
|
||||
foreach(User user in GetUsersOnSpecialTileCode("MULTIROOM-" + "P" + roomId.ToString())) // Send to each user!
|
||||
{
|
||||
if (user.Id == sender.LoggedinUser.Id)
|
||||
continue;
|
||||
|
@ -3610,6 +3615,93 @@ namespace HISP.Server
|
|||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case PacketBuilder.SWFMODULE_DRESSUPROOM:
|
||||
if (packet.Length < 6)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRESSUPROOM packet (swf communication, WRONG SIZE)");
|
||||
break;
|
||||
}
|
||||
if (packet[2] == PacketBuilder.DRESSUPROOM_LIST_ALL)
|
||||
{
|
||||
int roomId = packet[3] - 40;
|
||||
Dressup.DressupRoom room = Dressup.GetDressupRoom(roomId);
|
||||
|
||||
if (room.DressupPeices.Count > 0)
|
||||
{
|
||||
byte[] allDressupsResponse = PacketBuilder.CreateDressupRoomPeiceResponse(room.DressupPeices.ToArray());
|
||||
sender.SendPacket(allDressupsResponse);
|
||||
}
|
||||
|
||||
UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y, true, sender.LoggedinUser);
|
||||
}
|
||||
else // Move
|
||||
{
|
||||
if (packet.Length < 9)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRESSUPROOM MOVE packet (swf communication, WRONG SIZE)");
|
||||
break;
|
||||
}
|
||||
|
||||
int roomId = packet[2] - 40;
|
||||
if (roomId <= 0)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRESSUPROOM MOVE packet (swf communication, INVALID ROOM)");
|
||||
break;
|
||||
}
|
||||
Dressup.DressupRoom room = Dressup.GetDressupRoom(roomId);
|
||||
|
||||
string packetStr = Encoding.UTF8.GetString(packet);
|
||||
string moveStr = packetStr.Substring(3, packetStr.Length - 5);
|
||||
|
||||
string[] moves = moveStr.Split('|');
|
||||
|
||||
if(moves.Length < 3)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRESSUPROOM MOVE packet (swf communication, MOVES WRONG SIZE)");
|
||||
break;
|
||||
}
|
||||
|
||||
int peiceId;
|
||||
double moveToX;
|
||||
double moveToY;
|
||||
bool active = true;
|
||||
try // Make sure these are acturally numbers!
|
||||
{
|
||||
peiceId = int.Parse(moves[0]);
|
||||
if (moves[1] == "D" || moves[2] == "D")
|
||||
{
|
||||
active = false;
|
||||
moveToX = 0;
|
||||
moveToY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
moveToX = double.Parse(moves[1]);
|
||||
moveToY = double.Parse(moves[2]);
|
||||
}
|
||||
}
|
||||
catch(FormatException)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRESSUPROOM MOVE packet (swf communication, INVALID LOCATION)");
|
||||
break;
|
||||
}
|
||||
|
||||
Dressup.DressupPeice peice = room.GetDressupPeice(peiceId);
|
||||
// Update database entries
|
||||
peice.X = Convert.ToInt32(Math.Round(moveToX));
|
||||
peice.Y = Convert.ToInt32(Math.Round(moveToY));
|
||||
peice.Active = active;
|
||||
|
||||
// Forward to other users
|
||||
byte[] movePeicePacket = PacketBuilder.CreateDressupRoomPeiceMove(peice.PeiceId, moveToX, moveToY, peice.Active);
|
||||
User[] users = GetUsersAt(sender.LoggedinUser.X, sender.LoggedinUser.Y, true, true);
|
||||
foreach(User user in users)
|
||||
{
|
||||
if (user.Id != sender.LoggedinUser.Id)
|
||||
user.LoggedinClient.SendPacket(movePeicePacket);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PacketBuilder.SWFMODULE_ARENA:
|
||||
if (Arena.UserHasEnteredHorseInAnyArena(sender.LoggedinUser))
|
||||
|
@ -3622,6 +3714,7 @@ namespace HISP.Server
|
|||
continue;
|
||||
if(entry.EnteredUser.LoggedinClient.LoggedIn)
|
||||
entry.EnteredUser.LoggedinClient.SendPacket(response);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6703,14 +6796,15 @@ namespace HISP.Server
|
|||
|
||||
|
||||
}
|
||||
public static void UpdateAreaForAll(int x, int y, bool ignoreMetaPrio=false)
|
||||
public static void UpdateAreaForAll(int x, int y, bool ignoreMetaPrio=false, User exceptMe=null)
|
||||
{
|
||||
foreach(GameClient client in ConnectedClients)
|
||||
{
|
||||
if (client.LoggedIn)
|
||||
if (client.LoggedinUser.X == x && client.LoggedinUser.Y == y)
|
||||
if(!client.LoggedinUser.MetaPriority || ignoreMetaPrio)
|
||||
UpdateArea(client);
|
||||
if(client.LoggedinUser != exceptMe)
|
||||
UpdateArea(client);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,6 +115,7 @@ namespace HISP.Server
|
|||
public const byte SWFMODULE_ARENA = 0x52;
|
||||
public const byte SWFMODULE_BRICKPOET = 0x5A;
|
||||
public const byte SWFMODULE_DRAWINGROOM = 0x5B;
|
||||
public const byte SWFMODULE_DRESSUPROOM = 0x5C;
|
||||
|
||||
public const byte DRAWINGROOM_GET_DRAWING = 0x14;
|
||||
public const byte DRAWINGROOM_SAVE = 0x15;
|
||||
|
@ -123,6 +124,8 @@ namespace HISP.Server
|
|||
public const byte BRICKPOET_LIST_ALL = 0x14;
|
||||
public const byte BRICKPOET_MOVE = 0x55;
|
||||
|
||||
public const byte DRESSUPROOM_LIST_ALL = 0x14;
|
||||
|
||||
public const byte WISH_MONEY = 0x31;
|
||||
public const byte WISH_ITEMS = 0x32;
|
||||
public const byte WISH_WORLDPEACE = 0x33;
|
||||
|
@ -208,17 +211,68 @@ namespace HISP.Server
|
|||
public const byte DIRECTION_TELEPORT = 4;
|
||||
public const byte DIRECTION_NONE = 10;
|
||||
|
||||
public static byte[] CreateForwardedSwfRequest(byte[] request)
|
||||
public static byte[] CreateDressupRoomPeiceMove(int peiceId, double x, double y, bool active)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
ms.WriteByte(PacketBuilder.PACKET_SWFMODULE);
|
||||
ms.Write(request, 0x2, request.Length - 0x4);
|
||||
ms.WriteByte(PacketBuilder.PACKET_TERMINATOR);
|
||||
ms.WriteByte(PACKET_SWFMODULE);
|
||||
string packetStr = "";
|
||||
packetStr += peiceId.ToString() + "|";
|
||||
if (active)
|
||||
{
|
||||
packetStr += x.ToString() + "|";
|
||||
packetStr += y.ToString() + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
packetStr += "D|D|";
|
||||
}
|
||||
packetStr += "^";
|
||||
|
||||
byte[] packetBytes = Encoding.UTF8.GetBytes(packetStr);
|
||||
ms.Write(packetBytes, 0x00, packetBytes.Length);
|
||||
ms.WriteByte(PACKET_TERMINATOR);
|
||||
ms.Seek(0x00, SeekOrigin.Begin);
|
||||
byte[] response = ms.ToArray();
|
||||
ms.Dispose();
|
||||
return response;
|
||||
}
|
||||
public static byte[] CreateDressupRoomPeiceResponse(Dressup.DressupPeice[] dressupPeices)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
ms.WriteByte(PACKET_SWFMODULE);
|
||||
string packetStr = "";
|
||||
foreach(Dressup.DressupPeice peice in dressupPeices)
|
||||
{
|
||||
if (!peice.Active)
|
||||
continue;
|
||||
|
||||
packetStr += peice.PeiceId.ToString() + "|";
|
||||
packetStr += peice.X.ToString() + "|";
|
||||
packetStr += peice.Y.ToString() + "|";
|
||||
packetStr += "^";
|
||||
}
|
||||
|
||||
byte[] packetBytes = Encoding.UTF8.GetBytes(packetStr);
|
||||
ms.Write(packetBytes, 0x00, packetBytes.Length);
|
||||
ms.WriteByte(PACKET_TERMINATOR);
|
||||
ms.Seek(0x00, SeekOrigin.Begin);
|
||||
byte[] response = ms.ToArray();
|
||||
ms.Dispose();
|
||||
return response;
|
||||
}
|
||||
|
||||
public static byte[] CreateForwardedSwfRequest(byte[] request)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
ms.WriteByte(PACKET_SWFMODULE);
|
||||
ms.Write(request, 0x2, request.Length - 0x4);
|
||||
ms.WriteByte(PACKET_TERMINATOR);
|
||||
ms.Seek(0x00, SeekOrigin.Begin);
|
||||
byte[] response = ms.ToArray();
|
||||
ms.Dispose();
|
||||
return response;
|
||||
}
|
||||
|
||||
public static byte[] CreateBirdMap(int playerX, int playerY)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
|
@ -226,7 +280,7 @@ namespace HISP.Server
|
|||
int xstart = playerX - 24;
|
||||
int ystart = playerY - 15;
|
||||
|
||||
ms.WriteByte(PacketBuilder.PACKET_BIRDMAP);
|
||||
ms.WriteByte(PACKET_BIRDMAP);
|
||||
|
||||
for (int rely = 0; rely <= 30; rely++)
|
||||
{
|
||||
|
@ -261,7 +315,7 @@ namespace HISP.Server
|
|||
public static byte[] CreateDrawingUpdatePacket(string Drawing)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
ms.WriteByte(PacketBuilder.PACKET_SWFMODULE);
|
||||
ms.WriteByte(PACKET_SWFMODULE);
|
||||
byte[] drawingBytes = Encoding.UTF8.GetBytes(Drawing);
|
||||
ms.Write(drawingBytes, 0x00, drawingBytes.Length);
|
||||
ms.WriteByte(PACKET_TERMINATOR);
|
||||
|
@ -272,8 +326,8 @@ namespace HISP.Server
|
|||
{
|
||||
|
||||
MemoryStream ms = new MemoryStream();
|
||||
ms.WriteByte(PacketBuilder.PACKET_SWFMODULE);
|
||||
ms.WriteByte(PacketBuilder.BRICKPOET_MOVE);
|
||||
ms.WriteByte(PACKET_SWFMODULE);
|
||||
ms.WriteByte(BRICKPOET_MOVE);
|
||||
string packetStr = "|";
|
||||
packetStr += peice.Id + "|";
|
||||
packetStr += peice.X + "|";
|
||||
|
@ -289,7 +343,7 @@ namespace HISP.Server
|
|||
public static byte[] CreateBrickPoetListPacket(Brickpoet.PoetryPeice[] room)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
ms.WriteByte(PacketBuilder.PACKET_SWFMODULE);
|
||||
ms.WriteByte(PACKET_SWFMODULE);
|
||||
string packetStr = "";
|
||||
foreach(Brickpoet.PoetryPeice peice in room)
|
||||
{
|
||||
|
@ -307,7 +361,7 @@ namespace HISP.Server
|
|||
}
|
||||
byte[] packetBytes = Encoding.UTF8.GetBytes(packetStr);
|
||||
ms.Write(packetBytes, 0x00, packetBytes.Length);
|
||||
ms.WriteByte(PacketBuilder.PACKET_TERMINATOR);
|
||||
ms.WriteByte(PACKET_TERMINATOR);
|
||||
|
||||
ms.Seek(0x00, SeekOrigin.Begin);
|
||||
return ms.ToArray();
|
||||
|
|
|
@ -173,8 +173,8 @@ if(hasRightVersion) { // if we've detected an acceptable version
|
|||
var oeTags = '<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"'
|
||||
+ 'width=\"790\" height=\"500\" id=\"horseisle\" name=\"horseisle\"'
|
||||
+ 'codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\">'
|
||||
+ '<param name=\"movie\" value=\"horseisle_patched.swf?SERVER=".$server_ip."&PORT=".$server_port."&USER=&2158322\" /><param name=\"loop\" value=\"false\" /><param name=\"menu\" value=\"false\" /><param name=\"quality\" value=\"high\" /><param name=\"scale\" value=\"noscale\" /><param name=\"salign\" value=\"t\" /><param name=\"bgcolor\" value=\"#ffffff\" />'
|
||||
+ '<embed src=\"horseisle_patched.swf?SERVER=".$server_ip."&PORT=".$server_port."&USER=&2158322\" loop=\"false\" menu=\"false\" quality=\"high\" scale=\"noscale\" salign=\"t\" bgcolor=\"#ffffff\" '
|
||||
+ '<param name=\"movie\" value=\"horseisle.swf?SERVER=".$server_ip."&PORT=".$server_port."&USER=&2158322\" /><param name=\"loop\" value=\"false\" /><param name=\"menu\" value=\"false\" /><param name=\"quality\" value=\"high\" /><param name=\"scale\" value=\"noscale\" /><param name=\"salign\" value=\"t\" /><param name=\"bgcolor\" value=\"#ffffff\" />'
|
||||
+ '<embed src=\"horseisle.swf?SERVER=".$server_ip."&PORT=".$server_port."&USER=&2158322\" loop=\"false\" menu=\"false\" quality=\"high\" scale=\"noscale\" salign=\"t\" bgcolor=\"#ffffff\" '
|
||||
+ 'width=\"790\" height=\"500\" name=\"horseisle\" align=\"top\"'
|
||||
+ 'play=\"true\"'
|
||||
+ 'loop=\"false\"'
|
||||
|
|
0
WebInterface/game-site/horseisle.swf/horseisle_patched.swf → WebInterface/game-site/horseisle.swf
Executable file → Normal file
0
WebInterface/game-site/horseisle.swf/horseisle_patched.swf → WebInterface/game-site/horseisle.swf
Executable file → Normal file
Binary file not shown.
Binary file not shown.
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
# Decide which version to use
|
||||
if($_SERVER['HTTP_USER_AGENT'] == "Shockwave Flash") # Projector
|
||||
{
|
||||
$file = file_get_contents("horseisle_projector.swf");
|
||||
header("Content-Type: application/x-shockwave-flash");
|
||||
header("Content-Length: ".sizeof($file));
|
||||
echo($file);
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = file_get_contents("horseisle_patched.swf");
|
||||
header("Content-Type: application/x-shockwave-flash");
|
||||
header("Content-Length: ".sizeof($file));
|
||||
echo($file);
|
||||
}
|
||||
|
||||
?>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue