Exemplo n.º 1
0
        public static LotTileEntry[] GenFromCity(Common.DataService.Model.City city)
        {
            var entries = new Dictionary <uint, LotTileEntry>();

            foreach (var property in city.City_ReservedLotInfo)
            {
                entries[property.Key] = new LotTileEntry((int)property.Key, (short)(property.Key >> 16), (short)(property.Key & 0xFFFF), property.Value?LotTileFlags.Online:0);
            }

            foreach (var spot in city.City_SpotlightsVector)
            {
                LotTileEntry entry = null;
                if (entries.TryGetValue(spot, out entry))
                {
                    entry.flags |= LotTileFlags.Spotlight;
                }
            }

            return(entries.Values.ToArray());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Received CharacterCreation packet from CityServer.
        /// </summary>
        /// <returns>The result of the character creation.</returns>
        public static CharacterCreationStatus OnCharacterCreationStatus(NetworkClient Client, ProcessedPacket Packet)
        {
            LogThis.Log.LogThis("Received OnCharacterCreationStatus!", LogThis.eloglevel.info);

            CharacterCreationStatus CCStatus = (CharacterCreationStatus)Packet.ReadByte();

            ushort NumHouses = Packet.ReadUInt16();
            LotTileEntry[] TileEntries = new LotTileEntry[NumHouses];

            if (NumHouses > 0)
            {
                for (int i = 0; i < NumHouses; i++)
                {
                    TileEntries[i] = new LotTileEntry(Packet.ReadInt32(), Packet.ReadString(), (short)Packet.ReadUInt16(),
                        (short)Packet.ReadUInt16(), (byte)Packet.ReadByte(), Packet.ReadInt32());
                }
            }

            lock(GameFacade.CDataRetriever.LotTileData)
                GameFacade.CDataRetriever.LotTileData = TileEntries;

            return CCStatus;
        }
Exemplo n.º 3
0
        /// <summary>
        /// A player joined a session (game) in progress.
        /// </summary>
        public static LotTileEntry OnPlayerJoinedSession(NetworkClient Client, ProcessedPacket Packet)
        {
            LotTileEntry TileEntry = new LotTileEntry(0, "", 0, 0, 0, 0);

            UISim Avatar = new UISim(Packet.ReadString());
            Avatar.Name = Packet.ReadString();
            Avatar.Sex = Packet.ReadString();
            Avatar.Description = Packet.ReadString();
            Avatar.HeadOutfitID = Packet.ReadUInt64();
            Avatar.BodyOutfitID = Packet.ReadUInt64();
            Avatar.Avatar.Appearance = (AppearanceType)Packet.ReadInt32();

            byte HasHouse = (byte)Packet.ReadByte();

            if (HasHouse != 0)
            {
                TileEntry = new LotTileEntry(Packet.ReadInt32(), Packet.ReadString(), (short)Packet.ReadUInt16(),
                    (short)Packet.ReadUInt16(), (byte)Packet.ReadByte(), Packet.ReadInt32());

                Avatar.LotID = TileEntry.lotid;
                Avatar.HouseX = TileEntry.x;
                Avatar.HouseY = TileEntry.y;

                LotTileEntry[] TileEntries = new LotTileEntry[GameFacade.CDataRetriever.LotTileData.Length + 1];
                TileEntries[0] = TileEntry;
                GameFacade.CDataRetriever.LotTileData.CopyTo(TileEntries, 1);
            }

            lock (NetworkFacade.AvatarsInSession)
            {
                NetworkFacade.AvatarsInSession.Add(Avatar);
            }

            return TileEntry;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Received from the CityServer in response to a CITY_TOKEN packet.
        /// </summary>
        public static CityTransferStatus OnCityTokenResponse(NetworkClient Client, ProcessedPacket Packet)
        {
            LogThis.Log.LogThis("Received OnCityTokenResponse", LogThis.eloglevel.info);

            CityTransferStatus Status = (CityTransferStatus)Packet.ReadByte();

            ushort NumHouses = Packet.ReadUInt16();
            LotTileEntry[] TileEntries = new LotTileEntry[NumHouses];

            if (NumHouses > 0)
            {
                for(int i = 0; i < NumHouses; i++)
                {
                    TileEntries[i] = new LotTileEntry(Packet.ReadInt32(), Packet.ReadString(), (short)Packet.ReadUInt16(),
                        (short)Packet.ReadUInt16(), (byte)Packet.ReadByte(), Packet.ReadInt32());
                }
            }

            PlayerAccount.Money = Packet.ReadInt32();

            lock(GameFacade.CDataRetriever.LotTileData)
                GameFacade.CDataRetriever.LotTileData = TileEntries;

            return Status;
        }
Exemplo n.º 5
0
 private void Controller_OnLotCost(LotTileEntry Entry)
 {
     m_CurrentLot = Entry;
     m_LotCost = Entry.cost;
 }
Exemplo n.º 6
0
 public void populateCityLookup(LotTileEntry[] TileData)
 {
     LotTileEntry[] data = TileData;
     m_CityLookup = new Dictionary<Vector2, LotTileEntry>();
     for (int i = 0; i < data.Length; i++)
     {
         m_CityLookup[new Vector2(data[i].x, data[i].y)] = data[i];
     }
 }
Exemplo n.º 7
0
 private void Controller_OnPlayerJoined(LotTileEntry TileEntry)
 {
     LotTileEntry[] TileEntries = new LotTileEntry[GameFacade.CDataRetriever.LotTileData.Length + 1];
     TileEntries[0] = TileEntry;
     GameFacade.CDataRetriever.LotTileData.CopyTo(TileEntries, 1);
     CityRenderer.populateCityLookup(TileEntries);
 }