Add Dress up Multiroom?

This commit is contained in:
SilicaAndPina 2021-03-10 12:14:52 +13:00
parent 13435cf37f
commit 99c604e926
14 changed files with 420 additions and 47 deletions

View file

@ -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")
{

View 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;
}
}
}