Пример #1
0
        public static bool CanRoomBuilded(this HideOutRoomSlot slot, CHideOutRoom room)
        {
            if (slot.State != HideOutRoomSlotState.UnLocked)
            {
                return(false);
            }
            var startslot = slot;
            var nextSlot  = startslot;

            for (int i = 1; i < room.size; i++)
            {
                nextSlot = nextSlot.NextSlot;
                if (slot.State != HideOutRoomSlotState.UnLocked || nextSlot?.Level != startslot.Level)
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #2
0
 /// <summary>Builds the hideout room asynchronous.</summary>
 /// <param name="plugin">The plugin.</param>
 /// <param name="slot">The slot.</param>
 /// <param name="room">The identifier.</param>
 /// <returns></returns>
 public static async Task <string> BuildHideoutRoomAsync(this HzPluginBase plugin, HideOutRoomSlot slot, CHideOutRoom room)
 {
     return(await plugin.Account.DefaultRequestContent("buildHideoutRoom")
            .AddKeyValue("identifier", room.identifier)
            .AddKeyValue("slot", slot.Slot)
            .AddKeyValue("level", slot.Level)
            .AddKeyValue("rct", "1")
            .AddLog($"[HideOut] Build Room {room.identifier}")
            .PostToHzAsync());
 }
Пример #3
0
 public static IEnumerable <HideOutRoomSlot> GetFreeSlotsForRoom(this IEnumerable <HideOutRoomSlot> slots, CHideOutRoom room)
 {
     return(slots.Where(s => s.CanRoomBuilded(room)));
 }