public string ToQueryString()
        {
            string result = String.Empty;

            if (!String.IsNullOrEmpty(MergeCommitMessage))
            {
                result = QueryStringHelper.AddQueryParameter(result,
                                                             "merge_commit_message", WebUtility.UrlEncode(MergeCommitMessage.Replace("\r", "")));
            }
            if (!String.IsNullOrEmpty(SquashCommitMessage))
            {
                result = QueryStringHelper.AddQueryParameter(result,
                                                             "squash_commit_message", WebUtility.UrlEncode(SquashCommitMessage.Replace("\r", "")));
            }
            if (Squash.HasValue)
            {
                result = QueryStringHelper.AddQueryParameter(result, "squash", Squash.ToString().ToLower());
            }
            if (ShouldRemoveSourceBranch.HasValue)
            {
                result = QueryStringHelper.AddQueryParameter(result,
                                                             "should_remove_source_branch", ShouldRemoveSourceBranch.ToString().ToLower());
            }
            if (MergeWhenPipelineSucceeds.HasValue)
            {
                result = QueryStringHelper.AddQueryParameter(result,
                                                             "merge_when_pipeline_succeeds", MergeWhenPipelineSucceeds.ToString().ToLower());
            }
            if (!String.IsNullOrEmpty(Sha))
            {
                result = QueryStringHelper.AddQueryParameter(result, "state_event", WebUtility.UrlEncode(Sha));
            }
            return(result);
        }
        public string ToQueryString()
        {
            string result = String.Empty;

            result = QueryStringHelper.AddQueryParameter(result, "source_branch", WebUtility.UrlEncode(SourceBranch));
            result = QueryStringHelper.AddQueryParameter(result, "target_branch", WebUtility.UrlEncode(TargetBranch));
            result = QueryStringHelper.AddQueryParameter(result, "title", WebUtility.UrlEncode(Title.Replace("\r", "")));
            if (AssigneeId.HasValue)
            {
                result = QueryStringHelper.AddQueryParameter(result,
                                                             "assignee_id", AssigneeId.Value.ToString());
            }
            if (!String.IsNullOrEmpty(Description))
            {
                result = QueryStringHelper.AddQueryParameter(result,
                                                             "description", WebUtility.UrlEncode(Description.Replace("\r", "")));
            }
            if (RemoveSourceBranch.HasValue)
            {
                result = QueryStringHelper.AddQueryParameter(result,
                                                             "remove_source_branch", RemoveSourceBranch.ToString().ToLower());
            }
            if (Squash.HasValue)
            {
                result = QueryStringHelper.AddQueryParameter(result,
                                                             "squash", Squash.ToString().ToLower());
            }
            if (Labels != null)
            {
                result = QueryStringHelper.AddQueryParameter(result,
                                                             "labels", String.Join(",", Labels).ToLower());
            }
            return(result);
        }
 public void Chop(Mobile from)
 {
     if (from.InRange(this.GetWorldLocation(), 1))
     {
         if (from == m_sower)
         {
             from.Direction = from.GetDirectionTo(this);
             double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100;
             if ((lumberValue > .5) && (Utility.RandomDouble() <= lumberValue))
             {
                 Squash fruit = new Squash(Utility.Random(m_yield + 2));
                 from.AddToBackpack(fruit);
                 if (Utility.RandomDouble() <= .1)
                 {
                     Vines logs = new Vines(); from.AddToBackpack(logs);
                 }
             }
             this.Delete();
             from.SendMessage("You chop the plant up");
         }
         else
         {
             from.SendMessage("You do not own this plant !!!");
         }
     }
     else
     {
         from.SendLocalizedMessage(500446);
     }
 }
        public void Chop(Mobile from)
        {
            if (from.InRange(this.GetWorldLocation(), 1))
            {
                if ((chopTimer == null) || (!chopTimer.Running))
                {
                    if ((TreeHelper.TreeOrdinance) && (from.AccessLevel == AccessLevel.Player))
                    {
                        if (from.Region is Regions.GuardedRegion)
                        {
                            from.CriminalAction(true);
                        }
                    }

                    chopTimer = new TreeHelper.ChopAction(from);

                    Point3D pnt = this.Location;
                    Map     map = this.Map;

                    from.Direction = from.GetDirectionTo(this);
                    chopTimer.Start();

                    double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100;
                    if ((lumberValue > .5) && (Utility.RandomDouble() <= lumberValue))
                    {
                        Squash fruit = new Squash((int)Utility.Random(13) + m_yield);
                        from.AddToBackpack(fruit);

                        int cnt  = Utility.Random((int)(lumberValue * 10) + 1);
                        Log logs = new Log(cnt);                           // Fruitwood Logs ??
                        from.AddToBackpack(logs);

                        FruitTreeStump i_stump = new FruitTreeStump(typeof(SquashCrop));
                        Timer          poof    = new StumpTimer(this, i_stump, from);
                        poof.Start();
                    }
                    else
                    {
                        from.SendLocalizedMessage(500495);                        // You hack at the tree for a while, but fail to produce any useable wood.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500446);                 // That is too far away.
            }
        }
        public override void OnDoubleClick(Mobile from)
        {
            if (from.Mounted && !TreeHelper.CanPickMounted)
            {
                from.SendMessage("You cannot pick fruit while mounted.");
                return;
            }

            if (DateTime.Now > lastpicked.AddSeconds(3))               // 3 seconds between picking
            {
                lastpicked = DateTime.Now;

                int lumberValue = (int)from.Skills[SkillName.Lumberjacking].Value / 20;
                if (from.Mounted)
                {
                    ++lumberValue;
                }

                if (lumberValue < 0)
                {
                    from.SendMessage("You have no idea how to pick this fruit.");
                    return;
                }

                if (from.InRange(this.GetWorldLocation(), 2))
                {
                    if (m_yield < 1)
                    {
                        from.SendMessage("There is nothing here to harvest.");
                    }
                    else                     //check skill
                    {
                        from.Direction = from.GetDirectionTo(this);

                        from.Animate(from.Mounted ? 26:17, 7, 1, true, false, 0);

                        if (lumberValue < m_yield)
                        {
                            lumberValue = m_yield + 1;
                        }

                        int pick = Utility.Random(lumberValue);
                        if (pick == 0)
                        {
                            from.SendMessage("You do not manage to gather any fruit.");
                            return;
                        }

                        m_yield -= pick;
                        from.SendMessage("You pick {0} Squash{1}!", pick, (pick == 1 ? "" : "s"));

                        //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield ));

                        Squash crop = new Squash(pick);
                        from.AddToBackpack(crop);

                        if (!regrowTimer.Running)
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500446);                       // That is too far away.
                }
            }
        }
        public override void OnDoubleClick(Mobile from)
        {
            if (m_sower == null || m_sower.Deleted)
            {
                m_sower = from;
            }
            if (from != m_sower)
            {
                from.SendMessage("You do not own this plant !!!"); return;
            }

            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage("You cannot harvest a crop while mounted."); return;
            }
            if (DateTime.UtcNow > lastpicked.AddSeconds(3))
            {
                lastpicked = DateTime.UtcNow;
                int cookValue = (int)from.Skills[SkillName.Cooking].Value / 20;
                if (cookValue == 0)
                {
                    from.SendMessage("You have no idea how to harvest this crop."); return;
                }
                if (from.InRange(this.GetWorldLocation(), 1))
                {
                    if (m_yield < 1)
                    {
                        from.SendMessage("There is nothing here to harvest.");
                    }
                    else
                    {
                        from.Direction = from.GetDirectionTo(this);
                        from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0);
                        m_lastvisit = DateTime.UtcNow;
                        if (cookValue > m_yield)
                        {
                            cookValue = m_yield + 1;
                        }
                        int pick = Utility.RandomMinMax(cookValue - 4, cookValue);
                        if (pick < 0)
                        {
                            pick = 0;
                        }
                        if (pick == 0)
                        {
                            from.SendMessage("You do not manage to harvest any crops."); return;
                        }
                        m_yield -= pick;
                        from.SendMessage("You harvest {0} crop{1}!", pick, (pick == 1 ? "" : "s"));
                        if (m_yield < 1)
                        {
                            ((Item)this).ItemID = pickedGraphic;
                        }
                        Squash crop = new Squash(pick);
                        from.AddToBackpack(crop);
                        if (!regrowTimer.Running)
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage("You are too far away to harvest anything.");
                }
            }
        }
Beispiel #7
0
        public void KillPlayer(Mobile player)
        {
            player.SendMessage("You have been Painted!");
            player.Warmode = false;
            int team = -1;

            if (player.FindItemOnLayer(Layer.Cloak) != null)
            {
                team = player.FindItemOnLayer(Layer.Cloak).Hue;
            }

            else if (player.FindItemOnLayer(Layer.TwoHanded) != null)
            {
                team = player.FindItemOnLayer(Layer.TwoHanded).Hue;
                player.FindItemOnLayer(Layer.TwoHanded).Delete();
                Cloak cloak = new Cloak(team);
                cloak.Movable = false;
                player.AddItem(cloak);
            }

            bool Decrement = true;

            foreach (Item i in player.Backpack.Items)
            {
                if (i is Squash)
                {
                    Decrement = false;
                }
            }

            if (Decrement)
            {
                Squash squash = new Squash();
                squash.Visible = false;
                player.AddToBackpack(squash);
            }

            switch (team)
            {
            case 3:  { player.MoveToWorld(Exit1Dest, MapDest);    if (Decrement)
                       {
                           m_Team1 -= 1;
                       }
                       break; }

            case 38: { player.MoveToWorld(Exit2Dest, MapDest);    if (Decrement)
                       {
                           m_Team2 -= 1;
                       }
                       break; }

            case 68: { player.MoveToWorld(Exit3Dest, MapDest);    if (Decrement)
                       {
                           m_Team3 -= 1;
                       }
                       break; }

            case 53: { player.MoveToWorld(Exit4Dest, MapDest);    if (Decrement)
                       {
                           m_Team4 -= 1;
                       }
                       break; }

            default: break;
            }
        }