예제 #1
0
 internal void ResetGamemap(string newModelName, int wallHeight, int wallThick, int floorThick)
 {
     this.ModelName           = newModelName;
     this.mRoomData.ModelName = newModelName;
     this.mRoomData.ResetModel();
     this.mRoomData.WallHeight     = wallHeight;
     this.mRoomData.WallThickness  = WallThickness;
     this.mRoomData.FloorThickness = floorThick;
     this.gamemap = new Gamemap(this);
 }
예제 #2
0
		public static List<Vector2D> FindPath(RoomUser User, bool Diag, Gamemap Map, Vector2D Start, Vector2D End)
		{
			List<Vector2D> list = new List<Vector2D>();
			PathFinderNode pathFinderNode = PathFinder.FindPathReversed(User, Diag, Map, Start, End);
			if (pathFinderNode != null)
			{
				list.Add(End);
				while (pathFinderNode.Next != null)
				{
					list.Add(pathFinderNode.Next.Position);
					pathFinderNode = pathFinderNode.Next;
				}
			}
			return list;
		}
예제 #3
0
 internal bool SquareIsOpen(int x, int y, bool pOverride)
 {
     return(checked (this.mDynamicModel.MapSizeX - 1 >= x && this.mDynamicModel.MapSizeY - 1 >= y) && Gamemap.CanWalk(this.mGameMap[x, y], pOverride));
 }
예제 #4
0
 internal static Dictionary <int, ThreeDCoord> GetAffectedTiles(InteractionType type, int Length, int Width, int PosX, int PosY, int Rotation)
 {
     checked
     {
         if (!Gamemap.IsSoccerGoal(type))
         {
             int num = 0;
             Dictionary <int, ThreeDCoord> dictionary = new Dictionary <int, ThreeDCoord>();
             if (Length > 1)
             {
                 if (Rotation == 0 || Rotation == 4)
                 {
                     for (int i = 1; i < Length; i++)
                     {
                         dictionary.Add(num++, new ThreeDCoord(PosX, PosY + i, i));
                         for (int j = 1; j < Width; j++)
                         {
                             dictionary.Add(num++, new ThreeDCoord(PosX + j, PosY + i, (i < j) ? j : i));
                         }
                     }
                 }
                 else
                 {
                     if (Rotation == 2 || Rotation == 6)
                     {
                         for (int k = 1; k < Length; k++)
                         {
                             dictionary.Add(num++, new ThreeDCoord(PosX + k, PosY, k));
                             for (int l = 1; l < Width; l++)
                             {
                                 dictionary.Add(num++, new ThreeDCoord(PosX + k, PosY + l, (k < l) ? l : k));
                             }
                         }
                     }
                 }
             }
             if (Width > 1)
             {
                 if (Rotation == 0 || Rotation == 4)
                 {
                     for (int m = 1; m < Width; m++)
                     {
                         dictionary.Add(num++, new ThreeDCoord(PosX + m, PosY, m));
                         for (int n = 1; n < Length; n++)
                         {
                             dictionary.Add(num++, new ThreeDCoord(PosX + m, PosY + n, (m < n) ? n : m));
                         }
                     }
                 }
                 else
                 {
                     if (Rotation == 2 || Rotation == 6)
                     {
                         for (int num2 = 1; num2 < Width; num2++)
                         {
                             dictionary.Add(num++, new ThreeDCoord(PosX, PosY + num2, num2));
                             for (int num3 = 1; num3 < Length; num3++)
                             {
                                 dictionary.Add(num++, new ThreeDCoord(PosX + num3, PosY + num2, (num2 < num3) ? num3 : num2));
                             }
                         }
                     }
                 }
             }
             return(dictionary);
         }
         int num4 = 0;
         Dictionary <int, ThreeDCoord> dictionary2 = new Dictionary <int, ThreeDCoord>();
         if (Length > 1)
         {
             if (Rotation == 0 || Rotation == 4)
             {
                 for (int num5 = 1; num5 < Length; num5++)
                 {
                     dictionary2.Add(num4++, new ThreeDCoord(PosX, PosY + num5, num5));
                     for (int num6 = 1; num6 < Width; num6++)
                     {
                         dictionary2.Add(num4++, new ThreeDCoord(PosX + num6, PosY + num5, num5));
                     }
                 }
             }
             else
             {
                 if (Rotation == 2 || Rotation == 6)
                 {
                     for (int num7 = 1; num7 < Length; num7++)
                     {
                         dictionary2.Add(num4++, new ThreeDCoord(PosX + num7, PosY, num7));
                         for (int num8 = 1; num8 < Width; num8++)
                         {
                             dictionary2.Add(num4++, new ThreeDCoord(PosX + num7, PosY + num8, num7));
                         }
                     }
                 }
             }
         }
         if (Width > 1)
         {
             if (Rotation == 0 || Rotation == 4)
             {
                 for (int num9 = 1; num9 < Width; num9++)
                 {
                     dictionary2.Add(num4++, new ThreeDCoord(PosX + num9, PosY, num9));
                     for (int num10 = 1; num10 < Length; num10++)
                     {
                         dictionary2.Add(num4++, new ThreeDCoord(PosX + num9, PosY + num10, num9));
                     }
                 }
             }
             else
             {
                 if (Rotation == 2 || Rotation == 6)
                 {
                     for (int num11 = 1; num11 < Width; num11++)
                     {
                         dictionary2.Add(num4++, new ThreeDCoord(PosX, PosY + num11, num11));
                         for (int num12 = 1; num12 < Length; num12++)
                         {
                             dictionary2.Add(num4++, new ThreeDCoord(PosX + num12, PosY + num11, num11));
                         }
                     }
                 }
             }
         }
         return(dictionary2);
     }
 }
예제 #5
0
		public static PathFinderNode FindPathReversed(RoomUser User, bool Diag, Gamemap Map, Vector2D Start, Vector2D End)
		{
			MinHeap<PathFinderNode> minHeap = new MinHeap<PathFinderNode>(256);
			PathFinderNode[,] array = new PathFinderNode[Map.Model.MapSizeX, Map.Model.MapSizeY];
			PathFinderNode pathFinderNode = new PathFinderNode(Start);
			pathFinderNode.Cost = 0;
			PathFinderNode breadcrumb = new PathFinderNode(End);
			array[pathFinderNode.Position.X, pathFinderNode.Position.Y] = pathFinderNode;
			minHeap.Add(pathFinderNode);
			checked
			{
				while (minHeap.Count > 0)
				{
					pathFinderNode = minHeap.ExtractFirst();
					pathFinderNode.InClosed = true;
					int num = 0;
					while (Diag ? (num < PathFinder.DiagMovePoints.Length) : (num < PathFinder.NoDiagMovePoints.Length))
					{
						Vector2D vector2D = pathFinderNode.Position + (Diag ? PathFinder.DiagMovePoints[num] : PathFinder.NoDiagMovePoints[num]);
						bool endOfPath = vector2D.X == End.X && vector2D.Y == End.Y;
						if (Map.IsValidStep(User, new Vector2D(pathFinderNode.Position.X, pathFinderNode.Position.Y), vector2D, endOfPath, User.AllowOverride))
						{
							PathFinderNode pathFinderNode2;
							if (array[vector2D.X, vector2D.Y] == null)
							{
								pathFinderNode2 = new PathFinderNode(vector2D);
								array[vector2D.X, vector2D.Y] = pathFinderNode2;
							}
							else
							{
								pathFinderNode2 = array[vector2D.X, vector2D.Y];
							}
							if (!pathFinderNode2.InClosed)
							{
								int num2 = 0;
								if (pathFinderNode.Position.X != pathFinderNode2.Position.X)
								{
									num2++;
								}
								if (pathFinderNode.Position.Y != pathFinderNode2.Position.Y)
								{
									num2++;
								}
								int num3 = pathFinderNode.Cost + num2 + pathFinderNode2.Position.GetDistanceSquared(End);
								if (num3 < pathFinderNode2.Cost)
								{
									pathFinderNode2.Cost = num3;
									pathFinderNode2.Next = pathFinderNode;
								}
								if (!pathFinderNode2.InOpen)
								{
									if (pathFinderNode2.Equals(breadcrumb))
									{
										pathFinderNode2.Next = pathFinderNode;
										return pathFinderNode2;
									}
									pathFinderNode2.InOpen = true;
									minHeap.Add(pathFinderNode2);
								}
							}
						}
						num++;
					}
				}
				return null;
			}
		}
예제 #6
0
        private void Initialize(uint Id, string Name, string Description, string Type, string Owner, int OwnerId, int Category, int State, int TradeState, int UsersMax, string ModelName, int Score, List <string> pTags, int AllowPets, int AllowPetsEating, int AllowWalkthrough, int Hidewall, string Password, string Wallpaper, string Floor, string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Guild group, int GameId, int chattype, int chatballoon, int chatspeed, int chatmaxdis, int chatprotection, int whomute, int whokick, int whoban, uint groupid, HashSet <Chatlog> Chat, List <string> WordFilter, int WallHeight)
        {
            this.mDisposed   = false;
            this.Id          = Id;
            this.Name        = Name;
            this.Description = Description;
            this.Owner       = Owner;
            this.OwnerId     = OwnerId;
            this.Category    = Category;
            this.Type        = Type;
            this.State       = State;
            this.TradeState  = TradeState;
            this.UsersNow    = 0;
            this.UsersMax    = UsersMax;
            this.ModelName   = ModelName;
            this.Score       = Score;
            this.tagCount    = 0;
            this.Tags        = new ArrayList();
            foreach (string current in pTags)
            {
                this.tagCount++;
                this.Tags.Add(current);
            }
            this.ChatType            = chattype;
            this.ChatBalloon         = chatballoon;
            this.ChatSpeed           = chatspeed;
            this.ChatMaxDistance     = chatmaxdis;
            this.ChatFloodProtection = chatprotection;
            this.AllowPets           = AllowPets;
            this.AllowPetsEating     = AllowPetsEating;
            this.AllowWalkthrough    = AllowWalkthrough;
            this.Hidewall            = Hidewall;
            this.Group             = group;
            this.Password          = Password;
            this.Bans              = new Dictionary <long, double>();
            this.MutedUsers        = new Dictionary <uint, uint>();
            this.Wallpaper         = Wallpaper;
            this.Floor             = Floor;
            this.Landscape         = Landscape;
            this.ActiveTrades      = new ArrayList();
            this.MutedBots         = false;
            this.mCycleEnded       = false;
            this.mRoomData         = RoomData;
            this.EveryoneGotRights = RightOverride;
            this.LoadedGroups      = new Dictionary <uint, string>();
            this.roomKick          = new Queue();
            this.IdleTime          = 0;
            this.RoomMuted         = false;
            this.WallThickness     = walltickness;
            this.FloorThickness    = floorthickness;
            this.WallHeight        = WallHeight;
            this.gamemap           = new Gamemap(this);
            this.roomItemHandling  = new RoomItemHandling(this);
            this.roomUserManager   = new RoomUserManager(this);
            this.RoomChat          = Chat;
            this.WordFilter        = WordFilter;
            this.Event             = CyberEnvironment.GetGame().GetRoomEvents().GetEvent(Id);
            this.WhoCanBan         = whoban;
            this.WhoCanKick        = whokick;
            this.WhoCanBan         = whoban;
            this.GroupId           = groupid;
            this.LoadRights();
            this.LoadMusic();
            this.LoadBans();
            this.InitUserBots();

            this.RoomThread = new Thread(new ThreadStart(StartRoomProcessing));
            this.RoomThread.Start();
            CyberEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(this.mRoomData);
        }
예제 #7
0
        private void Initialize(uint Id, string Name, string Description, string Type, string Owner, int OwnerId, int Category, int State, int TradeState, int UsersMax, string ModelName, int Score, List<string> pTags, int AllowPets, int AllowPetsEating, int AllowWalkthrough, int Hidewall, string Password, string Wallpaper, string Floor, string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Guild group, int GameId, int chattype, int chatballoon, int chatspeed, int chatmaxdis, int chatprotection, int whomute, int whokick, int whoban, uint groupid, HashSet<Chatlog> Chat, List<string> WordFilter, int WallHeight)
        {
            this.mDisposed = false;
            this.Id = Id;
            this.Name = Name;
            this.Description = Description;
            this.Owner = Owner;
            this.OwnerId = OwnerId;
            this.Category = Category;
            this.Type = Type;
            this.State = State;
            this.TradeState = TradeState;
            this.UsersNow = 0;
            this.UsersMax = UsersMax;
            this.ModelName = ModelName;
            this.Score = Score;
            this.tagCount = 0;
            this.Tags = new ArrayList();
            foreach (string current in pTags)
            {
                this.tagCount++;
                this.Tags.Add(current);
            }
            this.ChatType = chattype;
            this.ChatBalloon = chatballoon;
            this.ChatSpeed = chatspeed;
            this.ChatMaxDistance = chatmaxdis;
            this.ChatFloodProtection = chatprotection;
            this.AllowPets = AllowPets;
            this.AllowPetsEating = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall = Hidewall;
            this.Group = group;
            this.Password = Password;
            this.Bans = new Dictionary<long, double>();
            this.MutedUsers = new Dictionary<uint, uint>();
            this.Wallpaper = Wallpaper;
            this.Floor = Floor;
            this.Landscape = Landscape;
            this.ActiveTrades = new ArrayList();
            this.MutedBots = false;
            this.mCycleEnded = false;
            this.mRoomData = RoomData;
            this.EveryoneGotRights = RightOverride;
            this.LoadedGroups = new Dictionary<uint, string>();
            this.roomKick = new Queue();
            this.IdleTime = 0;
            this.RoomMuted = false;
            this.WallThickness = walltickness;
            this.FloorThickness = floorthickness;
            this.WallHeight = WallHeight;
            this.gamemap = new Gamemap(this);
            this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager = new RoomUserManager(this);
            this.RoomChat = Chat;
            this.WordFilter = WordFilter;
            this.Event = CyberEnvironment.GetGame().GetRoomEvents().GetEvent(Id);
            this.WhoCanBan = whoban;
            this.WhoCanKick = whokick;
            this.WhoCanBan = whoban;
            this.GroupId = groupid;
            this.LoadRights();
            this.LoadMusic();
            this.LoadBans();
            this.InitUserBots();

            this.RoomThread = new Thread(new ThreadStart(StartRoomProcessing));
            this.RoomThread.Start();
            CyberEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(this.mRoomData);
        }
예제 #8
0
 internal void ResetGamemap(string newModelName, int wallHeight, int wallThick, int floorThick)
 {
     this.ModelName = newModelName;
     this.mRoomData.ModelName = newModelName;
     this.mRoomData.ResetModel();
     this.mRoomData.WallHeight = wallHeight;
     this.mRoomData.WallThickness = WallThickness;
     this.mRoomData.FloorThickness = floorThick;
     this.gamemap = new Gamemap(this);
 }