public void OnUserInteract(RoomEntity user, Room room, RoomItem item, int state) { if (!room.RoomRights.HasRights(user.Player.Id)) { return; } if (this.cracked) { return; } if (!int.TryParse(item.ExtraData, out int count)) { count = 0; } CrackableData data = Alias.Server.ItemManager.GetCrackableData(item.ItemData.Id); if (data == null) { return; } item.ExtraData = count + 1 + ""; if (int.Parse(item.ExtraData) >= data.Tick) { this.cracked = true; this.count = 3; } room.EntityManager.Send(new FloorItemUpdateComposer(item)); }
public void OnCycle(RoomItem item) { if (this.cracked) { if (this.count <= 0) { CrackableData data = Alias.Server.ItemManager.GetCrackableData(item.ItemData.Id); if (data == null) { return; } ItemData itemData = Alias.Server.ItemManager.GetItemData(data.GetRandomReward()); if (itemData == null) { return; } item.ItemData = itemData; item.ResetItem(true); item.Room.EntityManager.Send(new RemoveFloorItemComposer(item)); item.Room.EntityManager.Send(new AddFloorItemComposer(item)); this.cracked = false; } else { this.count--; } } }
private int CrackableAmount(int itemId) { CrackableData data = Alias.Server.ItemManager.GetCrackableData(itemId); return(data != null ? data.Tick : 0); }