Exemplo n.º 1
0
        public static void Pack(Conversation conversation, Frame frame, MessageType type, String content)
        {
            if (null == conversation)
            {
                throw new ArgumentNullException("conversation");
            }

            if (null == frame)
            {
                throw new ArgumentNullException("frame");
            }

            String httpFilename = FrameHelper.GetFrameFilename(conversation, frame, type);
            String http         = TSharkHelper.GetProtocolDetails(content, TSharkHelper.HEADER_HTTP);

            File.WriteAllText(httpFilename, http);

            String folder   = FrameHelper.GetFrameFolder(conversation, frame, type);
            String filename = String.Join(".", Path.GetFileNameWithoutExtension(httpFilename), CTTSettings.EXTENSION_XML);

            String xmlFilename = Path.Combine(folder, filename);
            String xml         = TSharkHelper.GetProtocolDetails(content, TSharkHelper.HEADER_XML);

            File.WriteAllText(xmlFilename, xml);
        }
    // ************************ Should sell items ************************
    public bool ShouldSellItems()
    {
        // Reset Debug frame since it's the top state
        FrameHelper.ClearDebugString();

        return(Bag.GetContainerNumFreeSlots <= 1);
    }
    // Search for items to split in inventory
    private bool WeHaveAnItemToSplit(string key)
    {
        ItemToSplit = null;
        Item _tempItemToGetAfterSplit = CurrentStep.ItemoCraft.Materials.Find(i => i.Item.SplitsInto != null).Item;

        if (CurrentStep.ItemoCraft.SplitsInto == null && _tempItemToGetAfterSplit == null)
        {
            FrameHelper.UpdateDebugFrame(key, "No item to split/merge");
            return(false);
        }

        Item _itemToSplit = _tempItemToGetAfterSplit.SplitsInto;

        foreach (WoWItem item in Bag.GetBagItem())
        {
            if (item.Name == _itemToSplit.Name &&
                ItemsManager.GetItemCountById(_itemToSplit.ItemId) > _itemToSplit.AmountRequiredToSplit)
            {
                FrameHelper.UpdateDebugFrame(key, $"Item to split/merge found : {_itemToSplit.Name}");
                ItemToSplit = _itemToSplit.Name;
                return(true);
            }
        }
        FrameHelper.UpdateDebugFrame(key, "No item to split/merge");
        return(false);
    }
Exemplo n.º 4
0
        public MainWindowModel()
        {
            Add_Command = Command.RegisterCommand(On_Add_Command);                  //Регистрация обработчика

            FrameHelper.SetFrame = (x) => { thisFrame = FrameHelper.GetFrame(x); }; //Функция обновляет текущий фрейм
            FrameHelper.SetFrame(typeof(Controls.AddClientUC));                     //Установим фрейм по умолчанию
        }
Exemplo n.º 5
0
    public override bool ShouldDisenchant()
    {
        string keyName = $"{Name}.DISENCHANT";

        /*
         * if (CurrentStep == null)
         * {
         *  FrameHelper.UpdateDebugFrame(keyName, "No step");
         *  return false;
         * }*/
        if (!Disenchant.KnownSpell)
        {
            FrameHelper.UpdateDebugFrame(keyName, "We don't know Disenchant");
            return(false);
        }
        ItemsToDisenchant.Clear();
        foreach (WoWItem item in Bag.GetBagItem())
        {
            if (item.GetItemInfo.ItemRarity > 1 && item.IsEquippableItem && LevelIsEnoughToDisenchant(item))
            {
                ItemsToDisenchant.Add(item);
            }
        }
        if (ItemsToDisenchant.Count > 0)
        {
            FrameHelper.UpdateDebugFrame(keyName, "RUNNING");
            return(true);
        }
        else
        {
            FrameHelper.UpdateDebugFrame(keyName, "No item to disenchant");
            return(false);
        }
    }
    // ************************ CRAFT ************************
    public bool ShouldCraft()
    {
        string key = $"{Name}.CRAFT";

        Logger.LogDebug($"{Name} : Checking if should craft");

        if (CurrenStepIsNull(key) ||
            UserMustBuyManuallyIsTrue(key) ||
            !MyCharLevelIsHighEnough(key) ||
            WeHaveItemsToFarm(key) ||
            !WeHaveAllMats(key) ||
            CurrentStepIsAListPrecraft(key) ||
            ItemToCraftIsAnEnchant(key))
        {
            return(false);
        }
        if (CurrentStepIsACraftAll(key) ||
            CurrentStepIsACraftToLevel(key))
        {
            return(true);
        }

        FrameHelper.UpdateDebugFrame(key, "WARNING : NO STEP AFTER CHECK");
        return(false);
    }
Exemplo n.º 7
0
    public override bool ShouldEnchant()
    {
        string keyName = $"{Name}.ENCHANT";

        if (CurrentStep == null)
        {
            FrameHelper.UpdateDebugFrame(keyName, "No step");
            return(false);
        }
        if (!MyCharLevelIsHighEnough())
        {
            FrameHelper.UpdateDebugFrame(keyName, "Level up first");
            return(false);
        }
        if (!CurrentStep.ItemoCraft.IsAnEnchant)
        {
            FrameHelper.UpdateDebugFrame(keyName, "Not an enchant");
            return(false);
        }
        if (!CurrentStep.HasMatsToCraftOne())
        {
            FrameHelper.UpdateDebugFrame(keyName, "Not enough materials");
            return(false);
        }
        if (!CurrentStep.KnownRecipe)
        {
            FrameHelper.UpdateDebugFrame(keyName, "We don't know the recipe");
            return(false);
        }

        FrameHelper.UpdateDebugFrame(keyName, "RUNNING");
        return(true);
    }
Exemplo n.º 8
0
        public async Task <Frame> Pop()
        {
            if (_input1 == null)
            {
                throw new ArgumentNullException();
            }
            if (_input2 == null)
            {
                throw new ArgumentNullException();
            }

            var frames = await Task.WhenAll(_input1.Pop(), _input2.Pop());

            FrameHelper.EnsureValid(frames[0], _width, _height);
            FrameHelper.EnsureValid(frames[1], _width, _height);

            var outputPixels = new Color[_width * _height];

            for (int i = 0; i < _width * _height; i++)
            {
                outputPixels[i] = MixColors(frames[0].Pixels[i], frames[1].Pixels[i], _mixerLevel);
            }

            return(new Frame(_width, _height, outputPixels));
        }
Exemplo n.º 9
0
 public override void Initialize()
 {
     levelNameInputFieldRef.Set(this);
     inputField.onValueChanged.AddListener(OnValueChanged);
     inputField.onEndEdit.AddListener(OnValueChanged);
     inputField.onEndEdit.AddListener(OnValueChanged);
     FrameHelper.WaitForFrames(1, () => inputField.text = levelNameStatus.Name);
 }
Exemplo n.º 10
0
 Color GetDefaultColor()
 {
     if (FrameHelper.IsDarkSkin(this.LookAndFeel))
     {
         return(lightColor);
     }
     return(darkColor);
 }
Exemplo n.º 11
0
            private void UpdateColors()
            {
                backColor = LookAndFeelHelper.GetSystemColorEx(lookAndFeel, SystemColors.Control);
                bool   isDarkSkin = FrameHelper.IsDarkSkin(lookAndFeel.ActiveLookAndFeel);
                double scale      = isDarkSkin ? 1.2 : 0.95;

                borderColor = Color.FromArgb(Math.Min((int)(backColor.R * scale), 255), Math.Min((int)(backColor.G * scale), 255), Math.Min((int)(backColor.B * scale), 255));
            }
Exemplo n.º 12
0
 public Tilemap(Entity entity, uint tileWidth, uint tileHeight, ITexels texture) : base(entity)
 {
     this.texture     = texture;
     this.tileWidth   = tileWidth;
     this.tileHeight  = tileHeight;
     this.frameHelper = new FrameHelper(tileWidth, tileHeight);
     this.vbo         = new VertexBuffer(6, PrimitiveType.Triangles, VertexBuffer.UsageSpecifier.Static);
 }
 // User must buy manually flag is on ?
 public bool UserMustBuyManuallyIsTrue(string key = null)
 {
     if (UserMustBuyManuallyFlag)
     {
         FrameHelper.UpdateDebugFrame(key, "User Must buy manually");
         return(true);
     }
     return(false);
 }
 // ********************************* CHECKS *********************************
 // Is CurrentStep null ?
 public bool CurrenStepIsNull(string key = null)
 {
     if (CurrentStep == null)
     {
         FrameHelper.UpdateDebugFrame(key, "No step");
         return(true);
     }
     return(false);
 }
Exemplo n.º 15
0
 public AnimatedSprite(Entity entity, ITexels texture, uint frameWidth, uint frameHeight) : base(entity)
 {
     this.texture        = texture;
     this.vao            = new Vertex[6];
     this.Color          = null;
     this.frameHelper    = new FrameHelper(frameWidth, frameHeight);
     this.animationClock = new Clock();
     this.animations     = new Dictionary <string, Animation>();
 }
 // Is the item to craft an enchant ?
 public bool ItemToCraftIsAnEnchant(string key = null)
 {
     if (CurrentStep.ItemoCraft.IsAnEnchant)
     {
         FrameHelper.UpdateDebugFrame(key, "Item to craft is an enchant");
         return(true);
     }
     return(false);
 }
Exemplo n.º 17
0
 public AnimatedSprite(Entity entity) : base(entity)
 {
     this.texture        = null;
     this.vao            = new Vertex[6];
     this.Color          = null;
     this.frameHelper    = null;
     this.animationClock = new SFML.System.Clock();
     this.animations     = new Dictionary <string, Animation>();
 }
        public async Task Push(Frame frame)
        {
            FrameHelper.EnsureValid(frame, _config.Width, _config.Height);

            foreach (var packet in _config.PatchConfig.GetPackets(frame))
            {
                await _sender.Send(packet);
            }
        }
 // We have mats to craft one ?
 public bool WeHaveMatsToCraftOne(string key = null)
 {
     if (CurrentStep.HasMatsToCraftOne())
     {
         FrameHelper.UpdateDebugFrame(key, "We have mats to craft one");
         return(true);
     }
     FrameHelper.UpdateDebugFrame(key, "We don't have mats to craft one");
     return(false);
 }
    // Must recalcultae flag is on ?
    public bool MustRecalculateIsTrue(string key = null)
    {
        if (MustRecalculateStepFlag)
        {
            return(true);
        }

        FrameHelper.UpdateDebugFrame(key, "The recalculate step flag is False");
        return(false);
    }
 // Is Bot.ProfileName null ?
 public bool BotProfileNameIsNull(string key = null)
 {
     if (Bot.ProfileName == null)
     {
         FrameHelper.UpdateDebugFrame(key, "Bot.ProfileName is null");
         return(true);
     }
     FrameHelper.UpdateDebugFrame(key, $"Bot.ProfileName is {Bot.ProfileName}");
     return(false);
 }
/*
 *  // Must wait for other profession to catch up ?
 *  public bool OtherProfessionShouldCatchUp(string key = null)
 *  {
 *      if (Phase > OtherProfession.Phase)
 *      {
 *          FrameHelper.UpdateDebugFrame(key, $"Waiting for {OtherProfession.Name} to catch up");
 *          return true;
 *      }
 *      return false;
 *  }
 */

    // Is our char level high enough ?
    public bool MyCharLevelIsHighEnough(string key = null)
    {
        if (ObjectManager.Me.Level >= MinimumCharLevel)
        {
            return(true);
        }

        FrameHelper.UpdateDebugFrame(key, $"Your character must be {MinimumCharLevel} to proceed");
        return(false);
    }
 // We still have items to farm ?
 public bool WeHaveItemsToFarm(string key = null)
 {
     if (AmountOfItemToFarm > 0)
     {
         FrameHelper.UpdateDebugFrame(key, $"We still have an item to farm");
         return(true);
     }
     FrameHelper.UpdateDebugFrame(key, $"No item left to farm");
     return(false);
 }
 // We have all materials ?
 public bool WeHaveAllMats(string key = null)
 {
     if (CurrentStep.HasAllMats())
     {
         FrameHelper.UpdateDebugFrame(key, "We have all materials");
         return(true);
     }
     FrameHelper.UpdateDebugFrame(key, "We don't have all materials");
     return(false);
 }
 // Current recipe must be bought ?
 public bool RecipeMustBeBought(string key = null)
 {
     if (CurrentStep.ItemoCraft.RecipeVendor != null)
     {
         FrameHelper.UpdateDebugFrame(key, "The recipe must be bought");
         return(true);
     }
     FrameHelper.UpdateDebugFrame(key, "The recipe can't be bought");
     return(false);
 }
 // Remaining mats can be bought ?
 public bool WeCanBuyRemainingMats(string key = null)
 {
     if (CurrentStep.CanBuyRemainingMats())
     {
         FrameHelper.UpdateDebugFrame(key, "We can buy the remaining mats");
         return(true);
     }
     FrameHelper.UpdateDebugFrame(key, "The remaining mats can't be bought");
     return(false);
 }
 // Current step is a CraftToLevel ?
 public bool CurrentStepIsACraftToLevel(string key = null)
 {
     if (CurrentStep.Type == Step.StepType.CraftToLevel)
     {
         FrameHelper.UpdateDebugFrame(key, "Current step is a CraftToLevel");
         return(true);
     }
     FrameHelper.UpdateDebugFrame(key, "Current step is not a CraftToLevel");
     return(false);
 }
 // Current step is a ListPrecraft ?
 public bool CurrentStepIsAListPrecraft(string key = null)
 {
     if (CurrentStep.Type == Step.StepType.ListPreCraft)
     {
         FrameHelper.UpdateDebugFrame(key, "Current step is a ListPreCraft");
         return(true);
     }
     FrameHelper.UpdateDebugFrame(key, "Current step is not a ListPreCraft");
     return(false);
 }
Exemplo n.º 29
0
 protected void form_DataBound(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(FrameHelper.GetHelpApiHref(false)) || string.IsNullOrEmpty(FrameHelper.GetHelpApiKey()))
     {
         var chk = this.form.DataControls["chkUseMLSearch"] as PXCheckBox;
         if (chk != null)
         {
             chk.Hidden = true;
         }
     }
 }
Exemplo n.º 30
0
        void ur_Received(UdpRevicer self, System.Net.IPEndPoint arg2, byte[] data)
        {
            if (!_isPlay)
            {
                return;
            }
            ur.beginReceive();
            RTPModel pkg = new RTPModel(data);

            queue.Enqueue(FrameHelper.getFrame(pkg.payload));
            recvFrameed.Invoke(this, pkg.SequenceNumber, pkg.TimeStamp);
        }