本文整理汇总了C#中DOL.GS.Housing.House.SaveIntoDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# House.SaveIntoDatabase方法的具体用法?C# House.SaveIntoDatabase怎么用?C# House.SaveIntoDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.Housing.House
的用法示例。
在下文中一共展示了House.SaveIntoDatabase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: RemoveHouse
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);
}
示例3: AddHouse
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();
}