public bool NeedsTracking(IPosition pos) { if (GlobalShop) { return(false); } return(ShopPosition.IsNear(pos)); }
public void TrackPosition(IPlayer p, IPosition oldPos, IPosition newPos) { bool oldInside = ShopPosition.IsInside(oldPos), newInside = ShopPosition.IsInside(newPos); if (oldInside == newInside) { return; } if (!oldInside && newInside) { p.Message("You entered the '{0}'-Shop. You can now use the shop related commands.", ShopName); p.SetCurrentShop(this); return; } if (oldInside && !newInside) { p.Message("You left the '{0}'-Shop.", ShopName); p.SetCurrentShop(null); return; } }
private static void Parse(JSONNode json) { CoinItems = new List<ShopItem>(); var coins = json["coins"]; for (int i = 0; i < coins.AsArray.Count; i++) { var item = new ShopItem(); var pos = new ShopPosition { Index = coins[i]["index"], Count = coins[i]["count"].AsInt, ShopItemType = ShopItemType.Coins }; item.Positions = new List<ShopPosition> {pos}; item.Price = coins[i]["price"].AsFloat; CoinItems.Add(item); } }