当前位置: 首页>>代码示例>>C#>>正文


C# House.AddConsignment方法代码示例

本文整理汇总了C#中DOL.GS.Housing.House.AddConsignment方法的典型用法代码示例。如果您正苦于以下问题:C# House.AddConsignment方法的具体用法?C# House.AddConsignment怎么用?C# House.AddConsignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DOL.GS.Housing.House的用法示例。


在下文中一共展示了House.AddConsignment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpgradeHouse

		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;
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:77,代码来源:HouseMgr.cs


注:本文中的DOL.GS.Housing.House.AddConsignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。