本文整理汇总了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;
}