/// <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); }
public static void SpawnLotMarker(DBHouse house) { var obj = new GameLotMarker { Position = new Vector3(house.X, house.Y, house.Z), CurrentRegionID = house.RegionID, Heading = (ushort)house.Heading, Name = "Lot Marker", Model = 1308, DatabaseItem = house }; //No clue how we can check if a region //is in albion, midgard or hibernia instead //of checking the region id directly switch (obj.CurrentRegionID) { case 2: obj.Model = 1308; obj.Name = "Albion Lot"; break; //ALB case 102: obj.Model = 1306; obj.Name = "Midgard Lot"; break; //MID case 202: obj.Model = 1307; obj.Name = "Hibernia Lot"; break; //HIB } obj.AddToWorld(); }
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); }
public static MerchantTradeItems GetLotMarkerItems(GameLotMarker marker) { switch (GameServer.ServerRules.GetLotMarkerListName(marker.CurrentRegionID).ToLower()) { case "housing_alb_lotmarker": return AlbionLotMarkerItems; case "housing_mid_lotmarker": return MidgardLotMarkerItems; case "housing_hib_lotmarker": return HiberniaLotMarkerItems; case "housing_custom_lotmarker": return CustomLotMarkerItems; } return new MerchantTradeItems(GameServer.ServerRules.GetLotMarkerListName(marker.CurrentRegionID)); }
public static void SpawnLotMarker(DBHouse house) { var obj = new GameLotMarker { X = house.X, Y = house.Y, Z = house.Z, CurrentRegionID = house.RegionID, Heading = (ushort) house.Heading, Name = "Lot Marker", Model = 1308, DatabaseItem = house }; //No clue how we can check if a region //is in albion, midgard or hibernia instead //of checking the region id directly switch (obj.CurrentRegionID) { case 2: obj.Model = 1308; obj.Name = "Albion Lot"; break; //ALB case 102: obj.Model = 1306; obj.Name = "Midgard Lot"; break; //MID case 202: obj.Model = 1307; obj.Name = "Hibernia Lot"; break; //HIB } obj.AddToWorld(); }