コード例 #1
0
        /// <summary>
        /// Attach this vault to a hookpoint in a house.
        /// </summary>
        /// <param name="house"></param>
        /// <param name="hookpointID"></param>
        /// <returns></returns>
        public bool Attach(House house, uint hookpointID, ushort heading)
        {
            if (house == null)
                return false;

            // register vault in the DB.
            var hookedItem = new DBHouseHookpointItem
            {
                HouseNumber = house.HouseNumber,
                HookpointID = hookpointID,
                Heading = (ushort)(heading % 4096),
                ItemTemplateID = _templateID,
                Index = (byte)Index
            };

            var hpitem = GameServer.Database.SelectObjects<DBHouseHookpointItem>("`HouseNumber` = @HouseNumber AND `HookpointID` = @HookpointID", new[] { new QueryParameter("@HouseNumber", house.HouseNumber), new QueryParameter("@HookpointID", hookpointID) });

			// if there isn't anything already on this hookpoint then add it to the DB
			if (hpitem.Count == 0)
			{
				GameServer.Database.AddObject(hookedItem);
			}

            // now add the vault to the house.
            return Attach(house, hookedItem);
        }
コード例 #2
0
ファイル: AccountVaultKeeper.cs プロジェクト: mynew4/DAoC
        /// <summary>
        /// An account vault that masquerades as a house vault to the game client
        /// </summary>
        /// <param name="player">Player who owns the vault</param>
        /// <param name="vaultNPC">NPC controlling the interaction between player and vault</param>
        /// <param name="vaultOwner">ID of vault owner (can be anything unique, if it's the account name then all toons on account can access the items)</param>
        /// <param name="vaultNumber">Valid vault IDs are 0-3</param>
        /// <param name="dummyTemplate">An ItemTemplate to satisfy the base class's constructor</param>
        public AccountVault(GamePlayer player, GameNPC vaultNPC, string vaultOwner, int vaultNumber, ItemTemplate dummyTemplate)
            : base(dummyTemplate, vaultNumber)
        {
            m_player = player;
            m_vaultNPC = vaultNPC;
            m_vaultOwner = vaultOwner;
            m_vaultNumber = vaultNumber;

            DBHouse dbh = new DBHouse();
            //was allowsave = false but uhh i replaced with allowadd = false
            dbh.AllowAdd = false;
            dbh.GuildHouse = false;
            dbh.HouseNumber = player.ObjectID;
            dbh.Name = player.Name + "'s House";
            dbh.OwnerID = player.DBCharacter.ObjectId;
            dbh.RegionID = player.CurrentRegionID;

            CurrentHouse = new House(dbh);
        }
コード例 #3
0
		public virtual void SendGarden(House house, int i)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseChangeGarden)))
			{
				pak.WriteShort((ushort) house.HouseNumber);
				pak.WriteByte(0x01);
				pak.WriteByte(0x00); // update
				var item = (OutdoorItem) house.OutdoorItems[i];
				pak.WriteByte((byte) i);
				pak.WriteShort((ushort) item.Model);
				pak.WriteByte((byte) item.Position);
				pak.WriteByte((byte) item.Rotation);
				SendTCP(pak);
			}
		}
コード例 #4
0
ファイル: PacketLib176.cs プロジェクト: Refizul/DOL-Kheldron
		public override void SendEnterHouse(House house)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseEnter));

			pak.WriteShort((ushort)house.HouseNumber);
			pak.WriteShort((ushort)25000);         //constant!
			pak.WriteInt((uint)house.X);
			pak.WriteInt((uint)house.Y);
			pak.WriteShort((ushort)house.Heading); //useless/ignored by client.
			pak.WriteByte(0x00);
			pak.WriteByte((byte)(house.GetGuildEmblemFlags() | (house.Emblem & 0x010000) >> 14));//new Guild Emblem
			pak.WriteShort((ushort)house.Emblem);	//emblem
			pak.WriteByte(0x00);
			pak.WriteByte(0x00);
			pak.WriteByte((byte)house.Model);
			pak.WriteByte(0x00);
			pak.WriteByte(0x00);
			pak.WriteByte(0x00);
			pak.WriteByte((byte)house.Rug1Color);
			pak.WriteByte((byte)house.Rug2Color);
			pak.WriteByte((byte)house.Rug3Color);
			pak.WriteByte((byte)house.Rug4Color);
			pak.WriteByte(0x00);

			SendTCP(pak);
		}
コード例 #5
0
ファイル: AbstractServerRules.cs プロジェクト: mynew4/DAoC
 /// <summary>
 /// This creates the housing consignment merchant attached to a house.
 /// You can override this to create your own consignment merchant derived from the standard merchant
 /// </summary>
 /// <returns></returns>
 public virtual GameConsignmentMerchant CreateHousingConsignmentMerchant(House house)
 {
     var m = new GameConsignmentMerchant();
     m.Name = "Consignment Merchant";
     return m;
 }
コード例 #6
0
		/// <summary>
		/// Attach this vault to a hookpoint in a house.
		/// </summary>
		/// <param name="house"></param>
		/// <param name="hookedItem"></param>
		/// <returns></returns>
		public bool Attach(House house, DBHouseHookpointItem hookedItem)
		{
			if (house == null || hookedItem == null)
				return false;

			_hookedItem = hookedItem;

			IPoint3D position = house.GetHookpointLocation(hookedItem.HookpointID);
			if (position == null)
				return false;

			CurrentHouse = house;
			CurrentRegionID = house.RegionID;
			InHouse = true;
			X = position.X;
			Y = position.Y;
			Z = position.Z;
			Heading = (ushort) (hookedItem.Heading%4096);
			AddToWorld();

			return true;
		}
コード例 #7
0
ファイル: HouseMgr.cs プロジェクト: mynew4/DAoC
		public static void ResetHouseData(House house)
		{
			house.Model = 0;
			house.Emblem = 0;
			house.IndoorGuildBanner = false;
			house.IndoorGuildShield = false;
			house.DoorMaterial = 0;
			house.OutdoorGuildBanner = false;
			house.OutdoorGuildShield = false;
			house.Porch = false;
			house.PorchMaterial = 0;
			house.PorchRoofColor = 0;
			house.RoofMaterial = 0;
			house.Rug1Color = 0;
			house.Rug2Color = 0;
			house.Rug3Color = 0;
			house.Rug4Color = 0;
			house.TrussMaterial = 0;
			house.WallMaterial = 0;
			house.WindowMaterial = 0;
		}
コード例 #8
0
ファイル: HouseMgr.cs プロジェクト: mynew4/DAoC
		public static void RemoveHouseItems(House house)
		{
			house.RemoveConsignmentMerchant();

			IList<DBHouseIndoorItem> iobjs = GameServer.Database.SelectObjects<DBHouseIndoorItem>("HouseNumber = " + house.HouseNumber);
			foreach (DBHouseIndoorItem item in iobjs)
			{
				GameServer.Database.DeleteObject(item);
			}
			house.IndoorItems.Clear();

			IList<DBHouseOutdoorItem> oobjs = GameServer.Database.SelectObjects<DBHouseOutdoorItem>("HouseNumber = " + house.HouseNumber);
			foreach (DBHouseOutdoorItem item in oobjs)
			{
				GameServer.Database.DeleteObject(item);
			}
			house.OutdoorItems.Clear();

			IList<DBHouseHookpointItem> hpobjs = GameServer.Database.SelectObjects<DBHouseHookpointItem>("HouseNumber = " + house.HouseNumber);
			foreach (DBHouseHookpointItem item in hpobjs)
			{
				GameServer.Database.DeleteObject(item);
			}

			foreach (DBHouseHookpointItem item in house.HousepointItems.Values)
			{
				if (item.GameObject is GameObject)
				{
					(item.GameObject as GameObject).Delete();
				}
			}
			house.HousepointItems.Clear();
		}
コード例 #9
0
		public virtual void SendFurniture(House house, int i)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HousingItem)))
			{
				pak.WriteShort((ushort) house.HouseNumber);
				pak.WriteByte(0x01); //cnt
				pak.WriteByte(0x00); //upd
				var item = (IndoorItem) house.IndoorItems[i];
				WriteHouseFurniture(pak, item, i);
				SendTCP(pak);
			}
		}
コード例 #10
0
		public virtual void SendFurniture(House house)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HousingItem)))
			{
				pak.WriteShort((ushort) house.HouseNumber);
				pak.WriteByte((byte) house.IndoorItems.Count);
				pak.WriteByte(0x80); //0x00 = update, 0x80 = complete package

				foreach (var entry in house.IndoorItems.OrderBy(entry => entry.Key))
				{
					var item = entry.Value;
					WriteHouseFurniture(pak, item, entry.Key);
				}

				SendTCP(pak);
			}
		}
コード例 #11
0
		public virtual void SendHouseUsersPermissions(House house)
		{
			if(house == null)
				return;

			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseUserPermissions)))
			{
				pak.WriteByte((byte)house.HousePermissions.Count()); // number of permissions
				pak.WriteByte(0x00); // ?
				pak.WriteShort((ushort)house.HouseNumber); // house number

				foreach (var entry in house.HousePermissions)
				{
					// grab permission
					var perm = entry.Value;

					pak.WriteByte((byte)entry.Key); // Slot
					pak.WriteByte(0x00); // ?
					pak.WriteByte(0x00); // ?
					pak.WriteByte((byte)perm.PermissionType); // Type (Guild, Class, Race ...)
					pak.WriteByte((byte)perm.PermissionLevel); // Level (Friend, Visitor ...)
					pak.WritePascalString(perm.DisplayName);
				}

				SendTCP(pak);
			}
		}
コード例 #12
0
		public virtual void SendToggleHousePoints(House house)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseTogglePoints)))
			{
				pak.WriteShort((ushort) house.HouseNumber);
				pak.WriteByte(0x04);
				pak.WriteByte(0x00);

				SendTCP(pak);
			}
		}
コード例 #13
0
		public virtual void SendExitHouse(House house, ushort unknown = 0)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseExit)))
			{
				pak.WriteShort((ushort) house.HouseNumber);
				pak.WriteShort(unknown);
				SendTCP(pak);
			}
		}
コード例 #14
0
		public virtual void SendEnterHouse(House house)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseEnter)))
			{
				pak.WriteShort((ushort) house.HouseNumber);
				pak.WriteShort(25000); //constant!
				pak.WriteInt((uint) house.X);
				pak.WriteInt((uint) house.Y);
				pak.WriteShort((ushort) house.Heading); //useless/ignored by client.
				pak.WriteByte(0x00);
				pak.WriteByte((byte) house.GetGuildEmblemFlags()); //emblem style
				pak.WriteShort((ushort) house.Emblem); //emblem
				pak.WriteByte(0x00);
				pak.WriteByte(0x00);
				pak.WriteByte((byte) house.Model);
				pak.WriteByte(0x00);
				pak.WriteByte(0x00);
				pak.WriteByte(0x00);
				pak.WriteByte((byte) house.Rug1Color);
				pak.WriteByte((byte) house.Rug2Color);
				pak.WriteByte((byte) house.Rug3Color);
				pak.WriteByte((byte) house.Rug4Color);
				pak.WriteByte(0x00);

				SendTCP(pak);
			}
		}
コード例 #15
0
		public virtual void SendHouseOccupied(House house, bool flagHouseOccuped)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseChangeGarden)))
			{
				pak.WriteShort((ushort) house.HouseNumber);
				pak.WriteByte(0x00);
				pak.WriteByte((byte) (flagHouseOccuped ? 1 : 0));

				SendTCP(pak);
			}
		}
コード例 #16
0
ファイル: HouseMgr.cs プロジェクト: mynew4/DAoC
		public static bool UpgradeHouse(House house, InventoryItem deed)
		{
			int newModel = 0;
			switch (deed.Id_nb)
			{
				case "housing_alb_cottage_deed":
					newModel = 1;
					break;
				case "housing_alb_house_deed":
					newModel = 2;
					break;
				case "housing_alb_villa_deed":
					newModel = 3;
					break;
				case "housing_alb_mansion_deed":
					newModel = 4;
					break;
				case "housing_mid_cottage_deed":
					newModel = 5;
					break;
				case "housing_mid_house_deed":
					newModel = 6;
					break;
				case "housing_mid_villa_deed":
					newModel = 7;
					break;
				case "housing_mid_mansion_deed":
					newModel = 8;
					break;
				case "housing_hib_cottage_deed":
					newModel = 9;
					break;
				case "housing_hib_house_deed":
					newModel = 10;
					break;
				case "housing_hib_villa_deed":
					newModel = 11;
					break;
				case "housing_hib_mansion_deed":
					newModel = 12;
					break;
			}

			if (newModel == 0)
				return false;

			// remove all players from the home before we upgrade it
			foreach (GamePlayer player in house.GetAllPlayersInHouse())
			{
				player.LeaveHouse();
			}

			// if there is a consignment merchant, we have to re-initialize since we changed the house
			var merchant = GameServer.Database.SelectObject<HouseConsignmentMerchant>("HouseNumber = '" + house.HouseNumber + "'");
			long oldMerchantMoney = 0;
			if (merchant != null)
			{
				oldMerchantMoney = merchant.Money;
			}

			RemoveHouseItems(house);

			// change the model of the house
			house.Model = newModel;

			// re-add the merchant if there was one
			if (merchant != null)
			{
				house.AddConsignment(oldMerchantMoney);
			}

			// save the house, and broadcast an update
			house.SaveIntoDatabase();
			house.SendUpdate();

			return true;
		}
コード例 #17
0
ファイル: HouseMgr.cs プロジェクト: mynew4/DAoC
		public static void RemoveHouse(House house)
		{
			// try and get the houses for the given region
			Dictionary<int, House> housesByRegion;
			_houseList.TryGetValue(house.RegionID, out housesByRegion);

			if (housesByRegion == null)
				return;

			// remove all players from the house
			foreach (GamePlayer player in house.GetAllPlayersInHouse())
			{
				player.LeaveHouse();
			}

			// remove the house for all nearby players
			foreach (GamePlayer player in WorldMgr.GetPlayersCloseToSpot(house, WorldMgr.OBJ_UPDATE_DISTANCE))
			{
				player.Out.SendRemoveHouse(house);
				player.Out.SendGarden(house);
			}

			if (house.Model > 0)
				log.WarnFormat("Removing house #{0} owned by {1}!", house.HouseNumber, house.DatabaseItem.Name);
			else
				log.WarnFormat("Lotmarker #{0} owned by {1} had rent due, lot now for sale!", house.HouseNumber, house.DatabaseItem.Name);

			RemoveHouseItems(house);
			RemoveHousePermissions(house);
			ResetHouseData(house);

			house.OwnerID = "";
			house.KeptMoney = 0;
			house.Name = ""; // not null !
			house.DatabaseItem.CreationTime = DateTime.Now;
			house.DatabaseItem.LastPaid = DateTime.MinValue;

			// saved the cleared house in the database
			house.SaveIntoDatabase();

			// remove the house from the list of houses in the region
			housesByRegion.Remove(house.HouseNumber);

			// spawn a lot marker for the now-empty lot
			GameLotMarker.SpawnLotMarker(house.DatabaseItem);
		}
コード例 #18
0
		public virtual void SendRentReminder(House house)
		{
			//0:00:58.047 S=>C 0xF7 show help window (topicIndex:106 houseLot?:4281)
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HelpWindow)))
			{
				pak.WriteShort(106); //short index
				pak.WriteShort((ushort) house.HouseNumber); //short lot
				SendTCP(pak);
			}
		}
コード例 #19
0
ファイル: HouseMgr.cs プロジェクト: mynew4/DAoC
		public static void RemoveHousePermissions(House house)
		{
			// clear the house number for the guild if this is a guild house
			if (house.DatabaseItem.GuildHouse)
			{
				Guild guild = GuildMgr.GetGuildByName(house.DatabaseItem.GuildName);
				if (guild != null)
				{
					guild.GuildHouseNumber = 0;
				}
			}

			house.DatabaseItem.GuildHouse = false;
			house.DatabaseItem.GuildName = null;

			IList<DBHousePermissions> pobjs = GameServer.Database.SelectObjects<DBHousePermissions>("HouseNumber = " + house.HouseNumber);
			foreach (DBHousePermissions item in pobjs)
			{
				GameServer.Database.DeleteObject(item);
			}
			house.PermissionLevels.Clear();

			IList<DBHouseCharsXPerms> cpobjs = GameServer.Database.SelectObjects<DBHouseCharsXPerms>("HouseNumber = " + house.HouseNumber);
			foreach (DBHouseCharsXPerms item in cpobjs)
			{
				GameServer.Database.DeleteObject(item);
			}
			house.CharXPermissions.Clear();
		}
コード例 #20
0
		public override void SendHouse(House house)
		{
			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseCreate)))
			{
				pak.WriteShort((ushort)house.HouseNumber);
				pak.WriteShort((ushort)house.Z);
				pak.WriteInt((uint)house.X);
				pak.WriteInt((uint)house.Y);
				pak.WriteShort((ushort)house.Heading);
				pak.WriteShort((ushort)house.PorchRoofColor);
				int flagPorchAndGuildEmblem = (house.Emblem & 0x010000) >> 13;//new Guild Emblem
				if (house.Porch)
					flagPorchAndGuildEmblem |= 1;
				if (house.OutdoorGuildBanner)
					flagPorchAndGuildEmblem |= 2;
				if (house.OutdoorGuildShield)
					flagPorchAndGuildEmblem |= 4;
				pak.WriteShort((ushort)flagPorchAndGuildEmblem);
				pak.WriteShort((ushort)house.Emblem);
				pak.WriteShort(0); // new in 1.89b+ (scheduled for resposession XXX hourses ago)
				pak.WriteByte((byte)house.Model);
				pak.WriteByte((byte)house.RoofMaterial);
				pak.WriteByte((byte)house.WallMaterial);
				pak.WriteByte((byte)house.DoorMaterial);
				pak.WriteByte((byte)house.TrussMaterial);
				pak.WriteByte((byte)house.PorchMaterial);
				pak.WriteByte((byte)house.WindowMaterial);
				pak.WriteByte(0);
				pak.WriteShort(0); // new in 1.89b+
				pak.WritePascalString(house.Name);
	
				SendTCP(pak);
			}
			
			// Update cache
			m_gameClient.HouseUpdateArray[new Tuple<ushort, ushort>(house.RegionID, (ushort)house.HouseNumber)] = GameTimer.GetTickCount();
		}
コード例 #21
0
ファイル: HouseMgr.cs プロジェクト: mynew4/DAoC
		/// <summary>
		/// Transfer a house to a guild house
		/// </summary>
		/// <param name="player"></param>
		/// <param name="house"></param>
		/// <returns></returns>
		public static bool HouseTransferToGuild(GamePlayer player, House house)
		{
			// player must be in a guild
			if (player.Guild == null)
				return false;

			// player's guild can't already have a guild house
			if (player.Guild.GuildOwnsHouse)
				return false;

			// player needs to own the house to be able to xfer it
			if (house.HasOwnerPermissions(player) == false)
			{
				ChatUtil.SendSystemMessage(player, "You do not own this house!");
				return false;
			}

			// player needs to be a GM in the guild to xfer his personal house to the guild
			if (player.Guild.HasRank(player, Guild.eRank.Leader) == false)
			{
				ChatUtil.SendSystemMessage(player, "You are not the leader of a guild!");
				return false;
			}

			// Demand any consignment merchant inventory is removed before allowing a transfer
			var consignmentMerchant = house.ConsignmentMerchant;
			if (consignmentMerchant != null && (consignmentMerchant.DBItems().Count > 0 || consignmentMerchant.TotalMoney > 0))
			{
				ChatUtil.SendSystemMessage(player, "All items and money must be removed from your consigmment merchant in order to transfer this house!");
				return false;
			}

			// send house xfer prompt to player
			player.Out.SendCustomDialog(LanguageMgr.GetTranslation(player.Client.Account.Language, "Scripts.Player.Housing.TransferToGuild", player.Guild.Name), MakeGuildLot);

			return true;
		}
コード例 #22
0
		public override void SendGarden(House house)
		{
			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseChangeGarden)))
			{
				pak.WriteShort((ushort)house.HouseNumber);
				pak.WriteShort(0); // sheduled for repossession (in hours) new in 1.89b+
				pak.WriteByte((byte)house.OutdoorItems.Count);
				pak.WriteByte(0x80);
	
				foreach (var entry in house.OutdoorItems.OrderBy(entry => entry.Key))
				{
					OutdoorItem item = entry.Value;
					pak.WriteByte((byte)entry.Key);
					pak.WriteShort((ushort)item.Model);
					pak.WriteByte((byte)item.Position);
					pak.WriteByte((byte)item.Rotation);
				}
	
				SendTCP(pak);
			}
			
			// Update cache
			m_gameClient.HouseUpdateArray.UpdateIfExists(new Tuple<ushort, ushort>(house.RegionID, (ushort)house.HouseNumber), GameTimer.GetTickCount());
		}
コード例 #23
0
		public override void SendGarden(House house, int i)
		{
			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseChangeGarden)))
			{
				pak.WriteShort((ushort)house.HouseNumber);
				pak.WriteShort(0); // sheduled for repossession (in hours) new in 1.89b+
				pak.WriteByte(0x01);
				pak.WriteByte(0x00); // update
				OutdoorItem item = (OutdoorItem)house.OutdoorItems[i];
				pak.WriteByte((byte)i);
				pak.WriteShort((ushort)item.Model);
				pak.WriteByte((byte)item.Position);
				pak.WriteByte((byte)item.Rotation);
				SendTCP(pak);
			}
			
			// Update cache
			m_gameClient.HouseUpdateArray.UpdateIfExists(new Tuple<ushort, ushort>(house.RegionID, (ushort)house.HouseNumber), GameTimer.GetTickCount());
		}
コード例 #24
0
		public override void SendHouseOccupied(House house, bool flagHouseOccuped)
		{
			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseChangeGarden)))
			{
				pak.WriteShort((ushort)house.HouseNumber);
				pak.WriteShort(0); // sheduled for repossession (in hours) new in 1.89b+
				pak.WriteByte(0x00);
				pak.WriteByte((byte)(flagHouseOccuped ? 1 : 0));
	
				SendTCP(pak);
			}
			
			// Update cache
			m_gameClient.HouseUpdateArray.UpdateIfExists(new Tuple<ushort, ushort>(house.RegionID, (ushort)house.HouseNumber), GameTimer.GetTickCount());
		}
コード例 #25
0
ファイル: LotMarker.cs プロジェクト: boscorillium/dol
		private void CreateHouse(GamePlayer player, int model)
		{
			DatabaseItem.Model = model;
			DatabaseItem.Name = player.Name;

			if (player.Guild != null)
			{
				DatabaseItem.Emblem = player.Guild.Emblem;
			}

			var house = new House(DatabaseItem);
			HouseMgr.AddHouse(house);

			if (model != 0)
			{
				// move all players outside the mesh
				foreach (GamePlayer p in player.GetPlayersInRadius(500))
				{
					house.Exit(p, true);
				}

				RemoveFromWorld();
				Delete();
			}
		}
コード例 #26
0
ファイル: HouseMgr.cs プロジェクト: mynew4/DAoC
		/// <summary>
		/// Spawn house or lotmarker on this lot
		/// </summary>
		/// <param name="house"></param>
		private static eLotSpawnType SpawnLot(DBHouse house, Dictionary<int, House> housesForRegion)
		{
			eLotSpawnType spawnType = eLotSpawnType.Marker;

			if (string.IsNullOrEmpty(house.OwnerID) == false)
			{
				var newHouse = new House(house) { UniqueID = house.HouseNumber };

				newHouse.LoadFromDatabase();

				// store the house
				housesForRegion.Add(newHouse.HouseNumber, newHouse);

				if (newHouse.Model > 0)
				{
					spawnType = eLotSpawnType.House;
				}
			}

			if (spawnType == eLotSpawnType.Marker)
			{
				// this is either an available lot or a purchased lot without a house
				GameLotMarker.SpawnLotMarker(house);
			}

			return spawnType;
		}
コード例 #27
0
ファイル: PacketLib176.cs プロジェクト: Refizul/DOL-Kheldron
		/*
		 * public override void SendPlayerBanner(GamePlayer player, int GuildEmblem)
		{
			if (player == null) return;
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.VisualEffect));
			pak.WriteShort((ushort) player.ObjectID);
			pak.WriteByte(12);
			if (GuildEmblem == 0)
			{
				pak.WriteByte(1);
			}
			else
			{
				pak.WriteByte(0);
			}
			int newEmblemBitMask = ((GuildEmblem & 0x010000) << 8) | (GuildEmblem & 0xFFFF);
			pak.WriteInt((uint)newEmblemBitMask);
			SendTCP(pak);
		}

		 */

		public override void SendHouse(House house)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseCreate));
			pak.WriteShort((ushort)house.HouseNumber);
			pak.WriteShort((ushort)house.Z);
			pak.WriteInt((uint)house.X);
			pak.WriteInt((uint)house.Y);
			pak.WriteShort((ushort)house.Heading);
			pak.WriteShort((ushort)house.PorchRoofColor);
			pak.WriteShort((ushort)(house.GetPorchAndGuildEmblemFlags() | (house.Emblem & 0x010000) >> 13));//new Guild Emblem
			pak.WriteShort((ushort)house.Emblem);
			pak.WriteByte((byte)house.Model);
			pak.WriteByte((byte)house.RoofMaterial);
			pak.WriteByte((byte)house.WallMaterial);
			pak.WriteByte((byte)house.DoorMaterial);
			pak.WriteByte((byte)house.TrussMaterial);
			pak.WriteByte((byte)house.PorchMaterial);
			pak.WriteByte((byte)house.WindowMaterial);
			pak.WriteByte(0x03);
			pak.WritePascalString(house.Name);

			SendTCP(pak);
		}
コード例 #28
0
ファイル: HouseMgr.cs プロジェクト: mynew4/DAoC
		public static void AddHouse(House house)
		{
			// try and get the houses for the given region
			Dictionary<int, House> housesByRegion;
			_houseList.TryGetValue(house.RegionID, out housesByRegion);

			if (housesByRegion == null)
				return;

			// if the house doesn't exist yet, add it
			if (!housesByRegion.ContainsKey(house.HouseNumber))
			{
				housesByRegion.Add(house.HouseNumber, house);
			}
			else
			{
				// replace the existing lot with our new house
				housesByRegion[house.HouseNumber] = house;
			}

			if (house.Model == 0)
			{
				// if this is a lot marker purchase then reset all permissions and customization
				RemoveHouseItems(house);
				RemoveHousePermissions(house);
				ResetHouseData(house);
			}
			else
			{
				// create a new set of permissions
				for (int i = HousingConstants.MinPermissionLevel; i < HousingConstants.MaxPermissionLevel + 1; i++)
				{
					if (house.PermissionLevels.ContainsKey(i))
					{
						var oldPermission = house.PermissionLevels[i];
						if (oldPermission != null)
						{
							GameServer.Database.DeleteObject(oldPermission);
						}
					}

					// create a new, blank permission
					var permission = new DBHousePermissions(house.HouseNumber, i);
					house.PermissionLevels.Add(i, permission);

					// add the permission to the database
					GameServer.Database.AddObject(permission);
				}
			}

			// save the house, broadcast an update
			house.SaveIntoDatabase();
			house.SendUpdate();
		}
コード例 #29
0
			/// <summary>
			/// Constructs a new EnterLeaveHouseAction
			/// </summary>
			/// <param name="actionSource">The actions source</param>
			/// <param name="house">The target house</param>
			/// <param name="enter">The enter house flag</param>
			public EnterLeaveHouseAction(GamePlayer actionSource, House house, int enter) : base(actionSource)
			{
				_house = house;
				_enter = enter;
			}
コード例 #30
0
		public virtual void SendGarden(House house)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseChangeGarden)))
			{
				pak.WriteShort((ushort) house.HouseNumber);
				pak.WriteByte((byte) house.OutdoorItems.Count);
				pak.WriteByte(0x80);

				foreach (var entry in house.OutdoorItems.OrderBy(entry => entry.Key))
				{
					var item = entry.Value;
					pak.WriteByte((byte) (entry.Key));
					pak.WriteShort((ushort) item.Model);
					pak.WriteByte((byte) item.Position);
					pak.WriteByte((byte) item.Rotation);
				}

				SendTCP(pak);
			}
		}