Inheritance: Item, IEquipable
Ejemplo n.º 1
0
 public void ShowMessage(Misc.MessageType type, string message)
 {
     if (vGroupInfo.Visible)
     {
         switch (type)
         {
             case Misc.MessageType.Error:
                 lblError.CssClass = "error";
                 break;
             case Misc.MessageType.Success:
                 lblError.CssClass = "message";
                 break;
         }                
         lblError.Text = message;
     }
     else if (vJoinGroup.Visible)
     {
         switch (type)
         {
             case Misc.MessageType.Error:
                 lblError2.CssClass = "error";
                 break;
             case Misc.MessageType.Success:
                 lblError2.CssClass = "message";
                 break;
         }                
         lblError2.Text = message;
     }
 }
Ejemplo n.º 2
0
 public static void requestEnd(string pluginid, Connector conn, ref Misc.PageElements pageElements, HttpRequest request, HttpResponse response)
 {
     bool cookiesEnabled = request.Cookies["cookie-control"] != null;
     // Add styling and toggle button
     Misc.Plugins.addHeaderCSS(pageElements["URL"] + "/Content/CSS/CookieControl.css", ref pageElements);
     Misc.Plugins.addHeaderJS(pageElements["URL"] + "/Content/JS/CookieControl.js", ref pageElements);
     // Add toggle button
     pageElements.appendToKey("BODY_FOOTER", Core.templates["cookiecontrol"]["toggle"]);
     // Add warning banner
     if (!cookiesEnabled)
         pageElements.appendToKey("BODY_HEADER", Core.templates["cookiecontrol"]["banner"]);
     else
     {
         // Check if cookies have been enabled, if so return - no need to remove cookies
         pageElements.setFlag("COOKIES_ON");
         return;
     }
     // Clear all the response cookies - these may have been added programmatically
     response.Cookies.Clear();
     // Add each cookie, sent in the request, in the response - to expire
     HttpCookie cookie;
     for (int i = 0; i < request.Cookies.Count; i++)
     {
         cookie = request.Cookies[i];
         if (cookie.Name != "ASP.NET_SessionId")
         {
             cookie.Expires = DateTime.Now.AddDays(-2);
             response.Cookies.Add(cookie);
         }
     }
 }
Ejemplo n.º 3
0
 // Algo d'ajout par insertion
 private static void InsertAddTList(ref Misc.TList L, int w, char k)
 {
     Misc.TList p, prec, nouv;
     p = L;
     prec = null; // sert à rien, c'est juste pour que VS croit pas qu'on arrive au else avec prec sans valeur.
     while (p.Weight != 0 && p.Weight < w) // weight = 0 équivaut à pointeur nul.
     {
         prec = p;
         p = p.Next;
     }
     nouv = new Misc.TList();
     nouv.Weight = w;
     nouv.Next = p;
     nouv.Tree = new Misc.TBinaryTree();
     nouv.Tree.Key = k;
     nouv.Tree.Left = null;
     nouv.Tree.Right = null;
     if (p == L)
     {
         L = nouv;
     }
     else
     {
         prec.Next = nouv;
     }
 }
Ejemplo n.º 4
0
 //Tillaggt! -Erik
 public void Draw(int w, int h, Misc.Camera cam, float ScaleFactor = 1f, bool ShadowPass = false)
 {
     for(int i = 0; i < 24; i++) {
         for(int k = 0; k < 24; k++) {
             map[i, k].Draw(w, h, cam, ScaleFactor, 0.0f, ShadowPass);
         }
     }
 }
Ejemplo n.º 5
0
 public static void Hitdetecion(Moveable obj, Misc.Quad[,] objlist)
 {
     foreach(Misc.Quad xobj in objlist) {
         if(obj.Bounds.IntersectsWith(obj.Bounds)) {
             obj.Direction = new OpenTK.Vector2(0, 0);
         }
     }
 }
Ejemplo n.º 6
0
	public override Item Clone ()
	{
		Misc item = new Misc();
		base.CloneBase(item);

		//copy all vars before return
		return item;
	}
Ejemplo n.º 7
0
        public void calculateKernelsForPositions(Map2d<float> map, ref Misc.Vector2<int>[] kernelPositions, ref float[] kernelValues )
        {
            int i;

            for( i = 0; i < kernelPositions.Length; i++ )
            {
                kernelValues[i] = multiplyKernelWithMapAtCenter(kernelPositions[i].x, kernelPositions[i].y, map);
            }
        }
Ejemplo n.º 8
0
 public static void handleRequest(string pluginid, Connector conn, ref Misc.PageElements pageElements, HttpRequest request, HttpResponse response)
 {
     switch (request.QueryString["page"])
     {
         case "captcha":
             if (!Core.settings[SETTINGS_KEY].getBool(SETTINGS_KEY_CAPTCHA_ENABLED)) return;
             pageCaptcha(pluginid, conn, ref pageElements, request, response);
             break;
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// A text formatting.
        /// </summary>
        public Formatting()
        {
            capsStyle = CapsStyle.none;
            strikethrough = StrikeThrough.none;
            script = Script.none;
            highlight = Highlight.none;
            underlineStyle = UnderlineStyle.none;
            misc = Misc.none;

            rPr = new XElement(XName.Get("rPr", DocX.w.NamespaceName));
        }
Ejemplo n.º 10
0
 public static Misc.TList CreateList(Misc.TFrequency frequency)
 {
     Misc.TList L = new Misc.TList();
     for (int i = 0; i < 255; i++)
     {
         if (frequency[i] > 0)
         {
             InsertAddTList(ref L, frequency[i], Convert.ToChar(i));
         }
     }
     return L;
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Internal method to get the transform relative to a bounding box
        /// </summary>
        /// <param name="bounds">The bounding box to transform relative to</param>
        /// <returns>A transform that is relative to a bounding box</returns>
        internal override Matrix3x2 GetTransformRelative(Misc.RectangleF bounds)
        {
            /* Find the relative center on the X axis */
            float centerX = bounds.X + (CenterX * bounds.Width);

            /* Find the relative center on the Y axis */
            float centerY = bounds.Y + (CenterY * bounds.Height);

            /* Create the rotation transform matrix */
            var transform = Matrix3x2.Rotation(Angle, new PointF(centerX, centerY));
          
            return transform;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// A text formatting.
        /// </summary>
        public Formatting()
        {
            capsStyle = CapsStyle.none;
            strikethrough = StrikeThrough.none;
            script = Script.none;
            highlight = Highlight.none;
            underlineStyle = UnderlineStyle.none;
            misc = Misc.none;

            // Use current culture by default
            language = CultureInfo.CurrentCulture;

            rPr = new XElement(XName.Get("rPr", DocX.w.NamespaceName));
        }
Ejemplo n.º 13
0
        /**
         * Clears the timed effect `ef_idx`.
         *
         * Returns true if the monster's timer was changed.
         */
        public static bool mon_clear_timed(int m_idx, Misc.MON_TMD ef_idx, ushort flag, bool id)
        {
            Monster m_ptr;

            Misc.assert(ef_idx >= 0 && ef_idx < Misc.MON_TMD.MAX);

            Misc.assert(m_idx > 0);
            m_ptr = Cave.cave_monster(Cave.cave, m_idx);

            if (m_ptr.m_timed[(int)ef_idx] == 0) return false;

            /* Clearing never fails */
            flag |= Misc.MON_TMD_FLG_NOFAIL;

            return mon_set_timed(m_ptr, ef_idx, 0, flag, id);
        }
Ejemplo n.º 14
0
 public static void handleRequest(string pluginid, Connector conn, ref Misc.PageElements pageElements, HttpRequest request, HttpResponse response)
 {
     // Toggle cookie-control
     HttpCookie cookie = request.Cookies["cookie-control"];
     if (cookie != null)
     {
         cookie.Expires = DateTime.Now.AddDays(-1);
         response.Cookies.Add(cookie);
     }
     else
         response.Cookies.Add(new HttpCookie("cookie-control", "1"));
     // Redirect to the origin or homepage
     if (request.UrlReferrer != null)
         response.Redirect(request.UrlReferrer.AbsoluteUri);
     else
         response.Redirect(pageElements["URL"]);
 }
Ejemplo n.º 15
0
 public static Misc.TBinaryTree CreateTree(Misc.TList list)
 {
     while (list.Next.Weight > 0)
     {
         if (list.Next.Weight <= list.Weight)
         {
             list.Tree.Left = list.Next.Tree;
             list.Tree.Right = list.Tree;
         }
         else
         {
             list.Tree.Right = list.Next.Tree;
             list.Tree.Left = list.Tree;
         }
         list.Tree.Key = '\0';
         list.Weight += list.Next.Weight;
         list = list.Next;
     }
     return list.Tree;
 }
Ejemplo n.º 16
0
        /**
         * Decreases the timed effect `ef_idx` by `timer`.
         *
         * Calculates the new timer, then passes that to mon_set_timed().
         * If a timer would be set to a negative number, it is set to 0 instead.
         * Note that decreasing a timed effect should never fail.
         *
         * Returns true if the monster's timer changed.
         */
        public static bool mon_dec_timed(int m_idx, Misc.MON_TMD ef_idx, int timer, ushort flag, bool id)
        {
            Monster m_ptr;

            Misc.assert(ef_idx >= 0 && ef_idx < Misc.MON_TMD.MAX);

            Misc.assert(m_idx > 0);
            m_ptr = Cave.cave_monster(Cave.cave, m_idx);

            Misc.assert(timer > 0);

            /* Decreasing is never resisted */
            flag |= Misc.MON_TMD_FLG_NOFAIL;

            /* New counter amount */
            timer = m_ptr.m_timed[(int)ef_idx] - timer;
            if (timer < 0)
                timer = 0;

            return mon_set_timed(m_ptr, ef_idx, timer, flag, id);
        }
Ejemplo n.º 17
0
 public static void handleRequest(string pluginid, Connector conn, ref Misc.PageElements pageElements, HttpRequest request, HttpResponse response)
 {
     switch (request.QueryString["1"])
     {
         case null:
         case "home":
             pageHome(pluginid, conn, ref pageElements, request, response);
             break;
         case "sync":
             pageSync(pluginid, conn, ref pageElements, request, response);
             break;
         case "package":
             pagePackage(pluginid, conn, ref pageElements, request, response);
             break;
         case "dump":
             pageDump(pluginid, conn, ref pageElements, request, response);
             break;
         case "upload":
             pageUpload(pluginid, conn, ref pageElements, request, response);
             break;
     }
 }
Ejemplo n.º 18
0
            Color ColorRoute(Misc.Vertex<int > curr, Color inpc)  // inpc, income predicted color
            {
                Color newpc = Color.OrangeRed;// some mess to make compiler happy
                if (inpc == Color.White) newpc = Color.Black; else newpc = Color.White;
                List<Color> currlist = new List<Color>();
                Color back;
                int i = 0;            
                if (curr._inner != Color.Gray) return curr._inner;
                curr._inner = Color.Red;
                g.CreateIterator(curr.id);
                while (g.IsValid())
                {
                    Misc.Vertex<int> newcurr;
                    newcurr = g.GetVertex(g.Current());// get linked vertex        
                    back =  ColorRoute(newcurr,newpc);
                    if (back == Color.Red) { newcurr._inner = newpc; back = newpc; }
                    currlist.Add(back);             
                    g.CreateIterator(curr.id);
                    for (int j = 0; j < i; j++) g.MoveNext();                      
                    g.MoveNext();
                    i++;
                }

                if (currlist.Count > 0)
                {
                    bool iswhite = (currlist[0] == Color.White);
                    for (int j = 0; j < currlist.Count; j++)
                    {
                        if (currlist[j] == Color.Red) continue;
                        bool localcc = (currlist[j] == Color.White);
                        if (localcc != iswhite) throw new Exception("Cant find solution");
                    }
                    if (iswhite) curr._inner = Color.Black; else curr._inner = Color.White;
                }
                else curr._inner = inpc;
                //  check bypassed, things are looking good, now able to color current vertex               
                    return curr._inner;
            }
Ejemplo n.º 19
0
        private bool Load(byte[] buffer, bool checkSignature)
        {
            Clear();

            try
            {
                using (BinaryReader reader = new BinaryReader(new MemoryStream(buffer)))
                {
                    Debug.Assert(reader.ReadUInt32() == headerMagic1, "Bad header magic");
                    Debug.Assert(reader.ReadUInt32() == headerMagic2, "Bad header magic");

                    uint fileLength = reader.ReadUInt32();
                    Debug.Assert(fileLength == buffer.Length, "Bad save data length");
                    Debug.Assert(fileLength == FileLength, "Bad save data length");

                    uint signature = reader.ReadUInt32();
                    if (checkSignature)
                    {
                        uint calculatedSignature = GetSignature(buffer);
                        Debug.Assert(calculatedSignature == signature, "Bad save data signature");
                    }

                    PlayCount = reader.ReadInt32();

                    Debug.Assert(reader.BaseStream.Position == UnkOffset1);
                    uint dataMagic1 = reader.ReadUInt32();
                    uint dataMagic2 = reader.ReadUInt32();
                    uint dataMagic3 = reader.ReadUInt32();
                    uint dataMagic4 = reader.ReadUInt32();
                    if ((dataMagic1 != 5 || dataMagic2 != 5 || dataMagic3 != 0 || dataMagic4 != 0x3F800000) &&
                        Debugger.IsAttached)
                    {
                        Debugger.Break();
                    }

                    Debug.Assert(reader.BaseStream.Position == StatsOffset);
                    Stats.Load(reader);

                    Debug.Assert(reader.BaseStream.Position == BattlePacksOffset);
                    for (int i = 0; i < Constants.NumBattlePacks; i++)
                    {
                        BattlePacks[i].Load(reader);
                    }

                    Debug.Assert(reader.BaseStream.Position == MiscDataOffset);
                    Misc.Load(reader);

                    Debug.Assert(reader.BaseStream.Position == CampaignDataOffset);
                    Campaign.Load(reader);

                    Debug.Assert(reader.BaseStream.Position == DecksOffset);
                    for (int i = 0; i < Constants.NumUserDecks; i++)
                    {
                        Decks[i].Load(reader);
                    }

                    Debug.Assert(reader.BaseStream.Position == CardListOffset);
                    CardList.Load(reader);

                    Debug.Assert(reader.BaseStream.Position == FileLength);
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Check the database
 /// </summary>
 /// <param name="parts">
 /// </param>
 private static void CheckDatabase(string[] parts)
 {
     Misc.CheckDatabase();
 }
Ejemplo n.º 21
0
 private void OnInterruptableTarget(object sender, Events.InterruptableTargetEventArgs args)
 {
     if (E.IsReady() && this.UseEGapclose && args.DangerLevel == DangerLevel.High && args.Sender.Distance(ObjectManager.Player) < 400)
     {
         var pos = ObjectManager.Player.Position.LSExtend(args.Sender.Position, -Misc.GiveRandomInt(300, 600));
         if (pos.IsUnderEnemyTurret() && !ObjectManager.Player.IsUnderEnemyTurret())
         {
             return;
         }
         E.Cast(ObjectManager.Player.Position.LSExtend(args.Sender.Position, -Misc.GiveRandomInt(300, 600)));
     }
 }
Ejemplo n.º 22
0
            public void dispatch()
            {
                bool setOffset = false;
                int  offset    = 0;

                dispatched = true;
                ConsoleColor color = Console.ForegroundColor;

                Console.CursorTop       = 1;
                Console.CursorLeft      = 0;
                Console.ForegroundColor = ConsoleColor.DarkYellow;

                Console.WriteLine("INTERACTIVE MENU");
                for (int i = 0; i < menuElements.Length; i++)
                {
                    if (menuElements[i] == "/")
                    {
                        iOffset   = i;
                        setOffset = true;
                        for (int j = 0; j < Misc.getMaxLength(menuElements) + 5; j++)
                        {
                            Console.Write("–");
                        }
                        Console.WriteLine();
                        offset++;
                        i++;
                    }
                    if (i == 0)
                    {
                        Console.Write("˥ " + (i + 1) + ". " + menuElements[i]);
                        if (expanded)
                        {
                            if (i == Array.IndexOf(menuElements, marker))
                            {
                                inexpand(i);
                            }
                            else
                            {
                                Console.WriteLine();
                            }
                        }
                        else
                        {
                            Console.WriteLine();
                        }
                    }
                    else if (i < menuElements.Length - 1)
                    {
                        Console.Write("| " + (i + 1) + ". " + menuElements[i]);
                        if (expanded)
                        {
                            if (i == Array.IndexOf(menuElements, marker))
                            {
                                inexpand(i);
                            }
                            else
                            {
                                Console.WriteLine();
                            }
                        }
                        else
                        {
                            Console.WriteLine();
                        }
                    }
                    else
                    {
                        Console.Write("˩ " + (i + 1) + ". " + menuElements[i]);
                        if (expanded)
                        {
                            if (i == Array.IndexOf(menuElements, marker))
                            {
                                inexpand(i);
                            }
                            else
                            {
                                Console.WriteLine();
                            }
                        }
                        else
                        {
                            Console.WriteLine();
                        }
                    }
                }
                if (!setOffset)
                {
                    iOffset = -1;
                }
                for (int i = 0; i < Console.BufferWidth; i++)
                {
                    Console.Write("=");
                }
                Console.ForegroundColor = color;
            }
Ejemplo n.º 23
0
        public void SendChunk(Server server, int clientid, Vector3i globalpos, Vector3i chunkpos)
        {
            ClientOnServer c     = server.clients[clientid];
            ServerChunk    chunk = server.d_Map.GetChunk(globalpos.x, globalpos.y, globalpos.z);

            server.ClientSeenChunkSet(clientid, chunkpos.x, chunkpos.y, chunkpos.z, (int)server.simulationcurrentframe);
            //sent++;
            byte[] compressedchunk;
            if (MapUtil.IsSolidChunk(chunk.data) && chunk.data[0] == 0)
            {
                //don't send empty chunk.
                compressedchunk = null;
            }
            else
            {
                compressedchunk = server.CompressChunkNetwork(chunk.data);
                //TODO: commented because it was being sent too early, before full column was generated.
                //if (!c.heightmapchunksseen.ContainsKey(new Vector2i(v.x, v.y)))
                {
                    byte[] heightmapchunk           = Misc.UshortArrayToByteArray(server.d_Map.GetHeightmapChunk(globalpos.x, globalpos.y));
                    byte[] compressedHeightmapChunk = server.d_NetworkCompression.Compress(heightmapchunk);
                    Packet_ServerHeightmapChunk p1  = new Packet_ServerHeightmapChunk()
                    {
                        X     = globalpos.x,
                        Y     = globalpos.y,
                        SizeX = Server.chunksize,
                        SizeY = Server.chunksize,
                        CompressedHeightmap = compressedHeightmapChunk,
                    };
                    server.SendPacket(clientid, server.Serialize(new Packet_Server()
                    {
                        Id             = Packet_ServerIdEnum.HeightmapChunk,
                        HeightmapChunk = p1
                    }));
                    c.heightmapchunksseen[new Vector2i(globalpos.x, globalpos.y)] = (int)server.simulationcurrentframe;
                }
            }
            if (compressedchunk != null)
            {
                foreach (byte[] part in Server.Parts(compressedchunk, 1024))
                {
                    Packet_ServerChunkPart p1 = new Packet_ServerChunkPart()
                    {
                        CompressedChunkPart = part,
                    };
                    server.SendPacket(clientid, server.Serialize(new Packet_Server()
                    {
                        Id        = Packet_ServerIdEnum.ChunkPart,
                        ChunkPart = p1
                    }));
                }
            }
            Packet_ServerChunk p = new Packet_ServerChunk()
            {
                X     = globalpos.x,
                Y     = globalpos.y,
                Z     = globalpos.z,
                SizeX = Server.chunksize,
                SizeY = Server.chunksize,
                SizeZ = Server.chunksize,
            };

            server.SendPacket(clientid, server.Serialize(new Packet_Server()
            {
                Id     = Packet_ServerIdEnum.Chunk_,
                Chunk_ = p
            }));
        }
Ejemplo n.º 24
0
        public bool TryGetEmulationElementName(object obj, out string name, out string containerName)
        {
            if (obj == null)
            {
                name          = null;
                containerName = null;
                return(false);
            }

            Tuple <string, string> result;

            if (nameCache.TryGetValue(obj, out result))
            {
                name          = result.Item1;
                containerName = result.Item2;
                return(true);
            }

            containerName = null;
            var objAsIPeripheral = obj as IPeripheral;

            if (objAsIPeripheral != null)
            {
                Machine machine;
                string  machName;

                if (TryGetMachineForPeripheral(objAsIPeripheral, out machine) && TryGetMachineName(machine, out machName))
                {
                    containerName = machName;
                    if (Misc.IsPythonObject(obj))
                    {
                        name = Misc.GetPythonName(obj);
                    }
                    else
                    {
                        if (!machine.TryGetAnyName(objAsIPeripheral, out name))
                        {
                            name = Machine.UnnamedPeripheral;
                        }
                    }
                    nameCache.Add(obj, Tuple.Create(name, containerName));
                    return(true);
                }
            }
            var objAsMachine = obj as Machine;

            if (objAsMachine != null)
            {
                if (EmulationManager.Instance.CurrentEmulation.TryGetMachineName(objAsMachine, out name))
                {
                    nameCache.Add(obj, Tuple.Create(name, containerName));
                    return(true);
                }
            }
            var objAsIExternal = obj as IExternal;

            if (objAsIExternal != null)
            {
                if (ExternalsManager.TryGetName(objAsIExternal, out name))
                {
                    nameCache.Add(obj, Tuple.Create(name, containerName));
                    return(true);
                }
            }

            var objAsIHostMachineElement = obj as IHostMachineElement;

            if (objAsIHostMachineElement != null)
            {
                if (HostMachine.TryGetName(objAsIHostMachineElement, out name))
                {
                    containerName = HostMachine.HostMachineName;
                    nameCache.Add(obj, Tuple.Create(name, containerName));
                    return(true);
                }
            }

            name = null;
            return(false);
        }
Ejemplo n.º 25
0
        public static string GetProcessTable(int alertID)
        {
            string tab1 = "";
            string tab2 = "";
            string tab3 = "";
            string tab4 = "";

            StringBuilder sb = new StringBuilder();


            using (AppDataContext db = new AppDataContext())
            {
                foreach (AlertProcessLog ev in db.AlertProcessLogs.Where(t => t.AlertId == alertID).OrderBy(t => t.UpdateTime).ToList())
                {
                    if (ev != null)
                    {
                        if (ev.UserId > 0)
                        {
                            tab1 = Data.User.Select(ev.UserId) == null ? "未知" : Data.User.Select(ev.UserId).UserName;
                        }
                        else
                        {
                            tab1 = "未知";
                        }

                        tab2 = Misc.GetAlertStatus((AlertStatusType)ev.AlertStatus);
                        tab3 = ev.ChangeReason;
                        tab4 = ev.UpdateTime.ToString("yyyy/MM/dd HH:mm:ss");


                        sb.AppendFormat(@"
                                        <tr>
                                        <td>
                                            {0}
                                        </td>
                                        <td>
                                           {1}
                                        </td>
                                        <td>
                                          {2}
                                        </td>                                        
                                        <td>
                                           {3}
                                        </td>
                                    </tr>", tab1, tab2, tab3, tab4);
                    }
                }
                if (sb.Length > 0)
                {
                    sb.Insert(0, @"<table class=""grid alternate fixed"" border=""0"" cellspacing=""0"" cellpadding=""0"">
                                <thead>    
                                <th width=200>处理人</th>
                                <th width=200>报警状态</th>
                                <th width=200>处理结果</th>
                                <th width=200>处理时间</th>
                                </thead>
                            ");
                    sb.Append(" </table>");
                }
            }
            return(sb.ToString());
        }
Ejemplo n.º 26
0
 internal void Open(string fileName, Types.DataSource source, Types.SnapshotConflictPolicy conflictPolicy, Action <OpenResponse> callback)
 {
     Misc.CheckNotNull <string>(fileName);
     Misc.CheckNotNull <Action <OpenResponse> >(callback);
     GooglePlayGames.Native.Cwrapper.SnapshotManager.SnapshotManager_Open(this.mServices.AsHandle(), source, fileName, conflictPolicy, new GooglePlayGames.Native.Cwrapper.SnapshotManager.OpenCallback(GooglePlayGames.Native.PInvoke.SnapshotManager.InternalOpenCallback), Callbacks.ToIntPtr <OpenResponse>(callback, new Func <IntPtr, OpenResponse>(OpenResponse.FromPointer)));
 }
Ejemplo n.º 27
0
 internal void Read(NativeSnapshotMetadata metadata, Action <ReadResponse> callback)
 {
     Misc.CheckNotNull <NativeSnapshotMetadata>(metadata);
     Misc.CheckNotNull <Action <ReadResponse> >(callback);
     GooglePlayGames.Native.Cwrapper.SnapshotManager.SnapshotManager_Read(this.mServices.AsHandle(), metadata.AsPointer(), new GooglePlayGames.Native.Cwrapper.SnapshotManager.ReadCallback(GooglePlayGames.Native.PInvoke.SnapshotManager.InternalReadCallback), Callbacks.ToIntPtr <ReadResponse>(callback, new Func <IntPtr, ReadResponse>(ReadResponse.FromPointer)));
 }
Ejemplo n.º 28
0
 internal void Delete(NativeSnapshotMetadata metadata)
 {
     Misc.CheckNotNull <NativeSnapshotMetadata>(metadata);
     GooglePlayGames.Native.Cwrapper.SnapshotManager.SnapshotManager_Delete(this.mServices.AsHandle(), metadata.AsPointer());
 }
Ejemplo n.º 29
0
 internal void Commit(NativeSnapshotMetadata metadata, NativeSnapshotMetadataChange metadataChange, byte[] updatedData, Action <CommitResponse> callback)
 {
     Misc.CheckNotNull <NativeSnapshotMetadata>(metadata);
     Misc.CheckNotNull <NativeSnapshotMetadataChange>(metadataChange);
     GooglePlayGames.Native.Cwrapper.SnapshotManager.SnapshotManager_Commit(this.mServices.AsHandle(), metadata.AsPointer(), metadataChange.AsPointer(), updatedData, new UIntPtr((ulong)updatedData.Length), new GooglePlayGames.Native.Cwrapper.SnapshotManager.CommitCallback(GooglePlayGames.Native.PInvoke.SnapshotManager.InternalCommitCallback), Callbacks.ToIntPtr <CommitResponse>(callback, new Func <IntPtr, CommitResponse>(CommitResponse.FromPointer)));
 }
Ejemplo n.º 30
0
 internal SnapshotManager(GooglePlayGames.Native.PInvoke.GameServices services)
 {
     this.mServices = Misc.CheckNotNull <GooglePlayGames.Native.PInvoke.GameServices>(services);
 }
Ejemplo n.º 31
0
    public void GenerateMeshes()
    {
        if (centerMaterial == null)
        {
            centerMaterial = Resources.Load("Materials/Intersections/Grid Intersection") as Material;
        }

        if (upConnectionMaterial == null)
        {
            upConnectionMaterial = Resources.Load("Materials/Intersections/Intersection Connections/2L Connection") as Material;
        }

        if (downConnectionMaterial == null)
        {
            downConnectionMaterial = Resources.Load("Materials/Intersections/Intersection Connections/2L Connection") as Material;
        }

        if (leftConnectionMaterial == null)
        {
            leftConnectionMaterial = Resources.Load("Materials/Intersections/Intersection Connections/2L Connection") as Material;
        }

        if (rightConnectionMaterial == null)
        {
            rightConnectionMaterial = Resources.Load("Materials/Intersections/Intersection Connections/2L Connection") as Material;
        }

        GenerateMesh(transform.GetChild(1), new Vector3(-width, heightOffset, -height), new Vector3(width, heightOffset, -height), new Vector3(-width, heightOffset, height), new Vector3(width, heightOffset, height), centerMaterial);

        if (upConnection == true)
        {
            transform.GetChild(0).GetChild(0).localPosition             = new Vector3(0, 0, height);
            transform.GetChild(0).GetChild(0).GetChild(1).localPosition = new Vector3(0, 0, upConnectionHeight);
            Misc.GenerateIntersectionConnection(width, upConnectionWidth, upConnectionResolution * 2, upConnectionHeight, heightOffset, transform.GetChild(0).GetChild(0).GetChild(0), upConnectionMaterial);
        }
        else
        {
            transform.GetChild(0).GetChild(0).GetChild(0).GetComponent <MeshFilter>().sharedMesh   = null;
            transform.GetChild(0).GetChild(0).GetChild(0).GetComponent <MeshCollider>().sharedMesh = null;
        }

        if (downConnection == true)
        {
            transform.GetChild(0).GetChild(1).localPosition             = new Vector3(0, 0, -height);
            transform.GetChild(0).GetChild(1).GetChild(1).localPosition = new Vector3(0, 0, downConnectionHeight);
            Misc.GenerateIntersectionConnection(width, downConnectionWidth, downConnectionResolution * 2, downConnectionHeight, heightOffset, transform.GetChild(0).GetChild(1).GetChild(0), downConnectionMaterial);
        }
        else
        {
            transform.GetChild(0).GetChild(1).GetChild(0).GetComponent <MeshFilter>().sharedMesh   = null;
            transform.GetChild(0).GetChild(1).GetChild(0).GetComponent <MeshCollider>().sharedMesh = null;
        }

        if (leftConnection == true)
        {
            transform.GetChild(0).GetChild(2).localPosition             = new Vector3(-width, 0, 0);
            transform.GetChild(0).GetChild(2).GetChild(1).localPosition = new Vector3(0, 0, leftConnectionHeight);
            Misc.GenerateIntersectionConnection(height, leftConnectionWidth, leftConnectionResolution * 2, leftConnectionHeight, heightOffset, transform.GetChild(0).GetChild(2).GetChild(0), leftConnectionMaterial);
        }
        else
        {
            transform.GetChild(0).GetChild(2).GetChild(0).GetComponent <MeshFilter>().sharedMesh   = null;
            transform.GetChild(0).GetChild(2).GetChild(0).GetComponent <MeshCollider>().sharedMesh = null;
        }

        if (rightConnection == true)
        {
            transform.GetChild(0).GetChild(3).localPosition             = new Vector3(width, 0, 0);
            transform.GetChild(0).GetChild(3).GetChild(1).localPosition = new Vector3(0, 0, rightConnectionHeight);
            Misc.GenerateIntersectionConnection(height, rightConnectionWidth, rightConnectionResolution * 2, rightConnectionHeight, heightOffset, transform.GetChild(0).GetChild(3).GetChild(0), rightConnectionMaterial);
        }
        else
        {
            transform.GetChild(0).GetChild(3).GetChild(0).GetComponent <MeshFilter>().sharedMesh   = null;
            transform.GetChild(0).GetChild(3).GetChild(0).GetComponent <MeshCollider>().sharedMesh = null;
        }
    }
Ejemplo n.º 32
0
 internal AchievementManager(GameServices services)
 {
     mServices = Misc.CheckNotNull(services);
 }
Ejemplo n.º 33
0
 private void UpdatePosition() => transform.localPosition = Misc.ConvertToMatrixCoordinates(position);
Ejemplo n.º 34
0
 internal void ShowAllUI(Action <CommonErrorStatus.UIStatus> callback)
 {
     Misc.CheckNotNull(callback);
     C.AchievementManager_ShowAllUI(mServices.AsHandle(),
                                    Callbacks.InternalShowUICallback, Callbacks.ToIntPtr(callback));
 }
Ejemplo n.º 35
0
        private void sellEnableCheck_CheckedChanged(object sender, EventArgs e)
        {
            if (World.Player == null)              // offline
            {
                if (sellEnableCheckBox.Checked)
                {
                    sellEnableCheckBox.Checked = false;
                    SellAgent.AddLog("You are not logged in game!");
                }
                return;
            }

            if (sellListSelect.Text == String.Empty)             // Nessuna lista
            {
                if (sellEnableCheckBox.Checked)
                {
                    sellEnableCheckBox.Checked = false;
                    SellAgent.AddLog("Item list not selected!");
                }
                return;
            }

            if (sellEnableCheckBox.Checked)
            {
                Assistant.Item bag = Assistant.World.FindItem(SellAgent.SellBag);

                if (bag != null && (bag.RootContainer != World.Player || !bag.IsContainer))
                {
                    SellAgent.AddLog("Invalid or not accessible Container!");
                    if (showagentmessageCheckBox.Checked)
                    {
                        Misc.SendMessage("Invalid or not accessible Container!", false);
                    }
                    sellEnableCheckBox.Checked = false;
                }
                else
                {
                    sellListSelect.Enabled       = false;
                    sellAddListButton.Enabled    = false;
                    sellRemoveListButton.Enabled = false;
                    sellCloneListButton.Enabled  = false;
                    SellAgent.AddLog("Apply item list " + sellListSelect.SelectedItem.ToString() + " filter ok!");
                    if (showagentmessageCheckBox.Checked)
                    {
                        Misc.SendMessage("Apply item list " + sellListSelect.SelectedItem.ToString() + " filter ok!", false);
                    }
                    SellAgent.EnableSellFilter();
                }
            }
            else
            {
                sellListSelect.Enabled       = true;
                sellAddListButton.Enabled    = true;
                sellRemoveListButton.Enabled = true;
                sellCloneListButton.Enabled  = true;
                if (sellListSelect.Text != String.Empty)
                {
                    RazorEnhanced.SellAgent.AddLog("Remove item list " + sellListSelect.SelectedItem.ToString() + " filter ok!");
                    if (showagentmessageCheckBox.Checked)
                    {
                        RazorEnhanced.Misc.SendMessage("Remove item list " + sellListSelect.SelectedItem.ToString() + " filter ok!", false);
                    }
                }
            }
        }
Ejemplo n.º 36
0
        internal void Unlock(string achievementId)
        {
            Misc.CheckNotNull(achievementId);

            C.AchievementManager_Unlock(mServices.AsHandle(), achievementId);
        }
Ejemplo n.º 37
0
        private Task ChangeFeedResponseHandler(Task <HttpResponseMessage> responseTask)
        {
            Misc.SafeDispose(ref changesFeedRequestTokenSource);

            if (responseTask.IsCanceled || responseTask.IsFaulted)
            {
                if (!responseTask.IsCanceled)
                {
                    var err = responseTask.Exception.Flatten();
                    Log.D(TAG, "ChangeFeedResponseHandler faulted.", err.InnerException ?? err);
                    Error = err.InnerException ?? err;
                    Stop();
                }

                return(Task.FromResult(false));
            }

            var response = responseTask.Result;

            if (response == null)
            {
                return(Task.FromResult(false));
            }

            var status = response.StatusCode;

            UpdateServerType(response);

            if ((Int32)status >= 300 && !Misc.IsTransientError(status))
            {
                var msg = response.Content != null
                    ? String.Format("Change tracker got error with status code: {0}", status)
                    : String.Format("Change tracker got error with status code: {0} and null response content", status);

                Log.E(TAG, msg);
                Error = new CouchbaseLiteException(msg, new Status(status.GetStatusCode()));
                Stop();
                response.Dispose();
                return(Task.FromResult(false));
            }

            switch (mode)
            {
            case ChangeTrackerMode.LongPoll:
                if (response.Content == null)
                {
                    throw new CouchbaseLiteException("Got empty change tracker response", status.GetStatusCode());
                }

                Log.D(TAG, "Getting stream from change tracker response");
                return(response.Content.ReadAsStreamAsync().ContinueWith(t => {
                    try {
                        backoff.ResetBackoff();
                        ProcessLongPollStream(t);
                    } finally {
                        response.Dispose();
                    }
                }));

            default:
                return(response.Content.ReadAsStreamAsync().ContinueWith(t => {
                    try {
                        backoff.ResetBackoff();
                        ProcessOneShotStream(t);
                    } finally {
                        response.Dispose();
                    }
                }));
            }
        }
Ejemplo n.º 38
0
 public static void ini()
 {
     Menu = MainMenu.AddMenu("Lux", "luxe");
     Menu.AddGroupLabel("Lux By Modziux");
     Prediction = Menu.AddSubMenu("Prediction", "spejimai");
     Prediction.Add("q.prediction", new Slider("Q Prediction", 80, 0, 100));
     Prediction.Add("e.prediction", new Slider("E Prediction", 80, 0, 100));
     Prediction.Add("r.prediction", new Slider("R Prediction", 80, 0, 100));
     Combo = Menu.AddSubMenu("Combo", "combolux");
     Combo.Add("combo.q", new CheckBox("Use Q"));
     Combo.AddSeparator();
     Combo.Add("combo.e", new CheckBox("Use E"));
     Combo.Add("combo.e.enemies", new Slider("Min enemies hit", 1, 1, 5));
     Combo.Add("e.slow", new CheckBox("Use E to Slow"));
     Combo.Add("e.detonate", new CheckBox("Auto Detonate E"));
     Combo.AddSeparator();
     Combo.Add("combo.r", new CheckBox("Use R"));
     Combo.Add("combo.r.logic", new ComboBox("R Logic", 2, "R only on killable", "R only on hit x target", "Both"));
     Combo.Add("combo.r.min", new Slider("Min enemies to use R", 2, 1, 5));
     Harras = Menu.AddSubMenu("Harass", "harassmenu");
     Harras.Add("harass.q", new CheckBox("Use Q"));
     Harras.AddSeparator();
     Harras.Add("harass.e", new CheckBox("Use E"));
     Harras.Add("harass.e.enemies", new Slider("Min enemies hit", 1, 1, 5));
     Laneclear = Menu.AddSubMenu("LaneClear", "Valiklis");
     Laneclear.Add("laneclear.e", new CheckBox("Use E"));
     Laneclear.Add("laneclear.e.min", new Slider("Cast E only if hit x minion", 3, 1, 10));
     Laneclear.AddSeparator();
     Laneclear.Add("laneclear.q", new CheckBox("Use Q"));
     Jungleclear = Menu.AddSubMenu("JungleClear", "Jungliu_Valiklis");
     Jungleclear.Add("jungleclear.e", new CheckBox("Use E"));
     Jungleclear.AddSeparator();
     Jungleclear.Add("jungleclear.q", new CheckBox("Use Q"));
     Drawing = Menu.AddSubMenu("Drawing", "piesimas");
     Drawing.Add("draw.q", new CheckBox("Draw Q Range"));
     Drawing.Add("draw.E", new CheckBox("Draw E Range"));
     Drawing.Add("draw.R", new CheckBox("Draw R Range"));
     Drawing.Add("indicator", new CheckBox("Show Damage Indicator"));
     Drawing.Add("percent.indicator", new CheckBox("Show damage Percent"));
     Drawing.Add("draw.r.a", new CheckBox("Draw Killable Champion name on screen"));
     Misc = Menu.AddSubMenu("Misc", "miscmenu");
     Misc.Add("auto.q", new CheckBox("Auto Q if Can hit 2 Champions"));
     Misc.Add("auto.q.imo", new CheckBox("Auto Q on Imobile target"));
     Misc.AddSeparator();
     Misc.Add("auto.e.min", new Slider("Auto E on X targets", 3, 1, 5));
     Misc.Add("auto.e.imo", new CheckBox("Auto E on Imobile target"));
     Misc.AddSeparator();
     Misc.Add("auto.r", new CheckBox("Auto R on killable"));
     Misc.AddSeparator();
     Misc.Add("use.ignite", new CheckBox("Use Ignite"));
     Misc.AddSeparator();
     Junglesteal = Menu.AddSubMenu("JungleSteal", "steal");
     Junglesteal.AddGroupLabel("Mobs");
     foreach (var name in Extension.exclusive)
     {
         Junglesteal.Add(name, new CheckBox(name));
     }
     Shield = Menu.AddSubMenu("W Shield", "w.usage");
     foreach (var ally in EntityManager.Heroes.Allies)
     {
         Shield.Add(ally.ChampionName, new CheckBox("Use shield on " + ally.ChampionName));
     }
     foreach (AIHeroClient client in EntityManager.Heroes.Enemies)
     {
         foreach (SpellInfo info in SpellDatabase.SpellList)
         {
             if (info.ChampionName == client.ChampionName)
             {
                 logic.Wlogic.EnemyProjectileInformation.Add(info);
             }
         }
     }
     foreach (AIHeroClient client in EntityManager.Heroes.Enemies)
     {
         foreach (SpellInfo info in SpellDatabase.SpellList)
         {
             if (info.ChampionName == client.ChampionName)
             {
                 logic.Wlogic.EnemyProjectileInformation.Add(info);
             }
         }
     }
 }
Ejemplo n.º 39
0
        public bool HandleTypeDecl(TypeDeclarationSyntax typeDecl, SemanticModel model)
        {
            if (!(typeDecl is ClassDeclarationSyntax) && !(typeDecl is StructDeclarationSyntax))
            {
                return(false);
            }

            var typeSymbol = model.GetDeclaredSymbol(typeDecl);

            if (typeSymbol == null)
            {
                return(false);
            }

            foreach (var attr in typeSymbol.GetAttributes())
            {
                if (attr.AttributeClass == null)
                {
                    continue;
                }

                if (Misc.IsPretuneAttribute(attr.AttributeClass, "ExcludeComparison"))
                {
                    if (typeSymbol is INamedTypeSymbol namedTypeSymbol)
                    {
                        if (namedTypeSymbol.IsGenericType)
                        {
                            if (namedTypeSymbol.IsUnboundGenericType)
                            {
                                excludedTypes.Add(namedTypeSymbol);
                            }
                            else
                            {
                                excludedTypes.Add(namedTypeSymbol.ConstructUnboundGenericType());
                            }
                        }
                        else
                        {
                            excludedTypes.Add(namedTypeSymbol);
                        }
                    }
                }

                if (Misc.IsPretuneAttribute(attr.AttributeClass, "CustomEqualityComparer"))
                {
                    foreach (var arg in attr.ConstructorArguments)
                    {
                        // TODO: 아니라면 워닝
                        if (arg.Kind == TypedConstantKind.Array)
                        {
                            foreach (var value in arg.Values)
                            {
                                if (value.Kind != TypedConstantKind.Type)
                                {
                                    continue;
                                }

                                if (value.Value is INamedTypeSymbol namedArg)
                                {
                                    // ImmutableArray<> ..
                                    if (namedArg.IsUnboundGenericType)
                                    {
                                        unboundTypeCustomEqComparers.Add(namedArg, typeSymbol);
                                    }
                                    else
                                    {
                                        boundTypeCustomEqComparers.Add(namedArg, typeSymbol);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(Misc.HasPretuneAttribute(typeDecl, model, "ImplementIEquatable"));
        }
Ejemplo n.º 40
0
	void DrawMiscList(ItemDataBase control)
	{
		ItemIndex = EditorGUILayout.IntSlider("Item Index", ItemIndex, 0, control.MiscList.Count - 1);
		
		EditorGUILayout.BeginHorizontal();
		
		if(GUILayout.Button("Add Item"))
		{
			var newMisc = new Misc();
			newMisc.Type = ItemType.Misc;
			control.MiscList.Add(newMisc);
			ItemIndex = control.MiscList.Count - 1;
		}
		
		if(GUILayout.Button("Remove Item"))
		{
			control.MiscList.RemoveAt(ItemIndex);
			ItemIndex = control.MiscList.Count - 1;
		}
		
		EditorGUILayout.EndHorizontal();
		EditorGUILayout.Space();
		
		CommonItemProps(control.MiscList[ItemIndex]);
	}
Ejemplo n.º 41
0
 private void EventsOnOnGapCloser(object sender, Events.GapCloserEventArgs args)
 {
     if (E.IsReady() && UseEGapclose && args.Sender.IsMelee && args.End.Distance(ObjectManager.Player.ServerPosition) > args.Sender.AttackRange)
     {
         var pos = ObjectManager.Player.Position.LSExtend(args.Sender.Position, -Misc.GiveRandomInt(250, 600));
         if (pos.IsUnderEnemyTurret() && !ObjectManager.Player.IsUnderEnemyTurret())
         {
             return;
         }
         E.Cast(ObjectManager.Player.Position.LSExtend(args.Sender.Position, -Misc.GiveRandomInt(250, 600)));
     }
 }
Ejemplo n.º 42
0
 public void ShowMessage(Misc.MessageType type, string message)
 {
     lblError.Text = message;
     switch (type)
     {
         case Misc.MessageType.Error:
             lblError.CssClass = "alert text-danger";
             break;
         case Misc.MessageType.Success:
             lblError.CssClass = "alert text-info";
             break;
     }
 }
Ejemplo n.º 43
0
        /// <summary>
        /// Initializing methods go here
        /// </summary>
        /// <returns>
        /// true if ok
        /// </returns>
        private static bool Initialize()
        {
            Console.WriteLine();
            Colouring.Push(ConsoleColor.Green);

            if (!InitializeGameFunctions())
            {
                Colouring.Push(ConsoleColor.Red);
                Console.WriteLine(locales.ErrorInitializingGamefunctions);
                Colouring.Pop();
                Colouring.Pop();
                return(false);
            }

            if (!InitializeLogAndBug())
            {
                Colouring.Push(ConsoleColor.Red);
                Console.WriteLine(locales.ErrorInitializingNLogNBug);
                Colouring.Pop();
                Colouring.Pop();
                return(false);
            }

            if (!CheckZoneServerCreation())
            {
                Colouring.Push(ConsoleColor.Red);
                Console.WriteLine(locales.ErrorCreatingZoneServerInstance);
                Colouring.Pop();
                Colouring.Pop();
                return(false);
            }

            if (!ISComInitialization())
            {
                Colouring.Push(ConsoleColor.Red);
                Console.WriteLine(locales.ErrorInitializingISCom);
                Colouring.Pop();
                Colouring.Pop();
                return(false);
            }

            if (!InizializeTCPIP())
            {
                Colouring.Push(ConsoleColor.Red);
                Console.WriteLine(locales.ErrorTCPIPSetup);
                Colouring.Pop();
                Colouring.Pop();
                return(false);
            }

            if (!Misc.CheckDatabase())
            {
                Colouring.Push(ConsoleColor.Red);
                Console.WriteLine(locales.ErrorInitializingDatabase);
                Colouring.Pop();
                Colouring.Pop();
                return(false);
            }

            Colouring.Push(ConsoleColor.Green);
            if (!LoadItemsAndNanos())
            {
                Colouring.Push(ConsoleColor.Red);
                Console.WriteLine(locales.ErrorLoadingItemsNanos);
                Colouring.Pop();
                Colouring.Pop();
                return(false);
            }

            Colouring.Pop();

            Colouring.Push(ConsoleColor.Green);
            if (!LoadTradeSkills())
            {
                Colouring.Push(ConsoleColor.Red);
                Console.WriteLine("No locale yet: Error reading trade skills");
                Colouring.Pop();
                Colouring.Pop();
                return(false);
            }

            Colouring.Pop();

            if (!InitializeConsoleCommands())
            {
                return(false);
            }

            Colouring.Pop();

            return(true);
        }
Ejemplo n.º 44
0
		public bool CanEdit(Misc m)
		{
			if (this.IsAdmin)
				return true;
			if (this.K == m.UsrK)
				return true;
			if (m.Promoter != null && this.IsEnabledPromoter(m.PromoterK))
				return true;

			return false;
		}
Ejemplo n.º 45
0
    private void OnSceneGUI()
    {
        Point             point       = (Point)target;
        RoadCreator       roadCreator = null;
        PrefabLineCreator prefabLine  = null;

        if (point.roadPoint == true)
        {
            roadCreator = point.transform.parent.parent.parent.parent.GetComponent <RoadCreator>();

            if (roadCreator.settings == null)
            {
                roadCreator.settings = RoadCreatorSettings.GetSerializedSettings();
            }
        }
        else
        {
            prefabLine = point.transform.parent.parent.GetComponent <PrefabLineCreator>();

            if (prefabLine.settings == null)
            {
                prefabLine.settings = RoadCreatorSettings.GetSerializedSettings();
            }
        }

        if (point.transform.hasChanged == true)
        {
            point.transform.rotation   = Quaternion.identity;
            point.transform.localScale = Vector3.one;

            if (point.roadPoint == true)
            {
                if (point.name == "Control Point")
                {
                    point.transform.parent.parent.GetComponent <RoadSegment>().curved = true;
                }
                else
                {
                    if (point.transform.parent.parent.GetComponent <RoadSegment>().curved == false)
                    {
                        point.transform.parent.GetChild(1).position = Misc.GetCenter(point.transform.parent.GetChild(0).position, point.transform.parent.GetChild(2).position);
                    }

                    if (point.name == "Start Point" && point.transform.parent.parent.GetSiblingIndex() > 0)
                    {
                        point.transform.parent.parent.parent.GetChild(point.transform.parent.parent.GetSiblingIndex() - 1).GetChild(0).GetChild(2).position = point.transform.position;
                    }
                    else if (point.name == "End Point" && point.transform.parent.parent.GetSiblingIndex() < point.transform.parent.parent.parent.childCount - 1)
                    {
                        point.transform.parent.parent.parent.GetChild(point.transform.parent.parent.GetSiblingIndex() + 1).GetChild(0).GetChild(0).position = point.transform.position;
                    }
                }

                roadCreator.CreateMesh();
            }
            else if (prefabLine != null)
            {
                prefabLine.PlacePrefabs();
            }

            point.transform.hasChanged = false;
        }

        // Draw points
        if (point.roadPoint == true)
        {
            if (point.name == "Control Point")
            {
                Handles.color = roadCreator.settings.FindProperty("controlPointColour").colorValue;
            }
            else
            {
                Handles.color = roadCreator.settings.FindProperty("pointColour").colorValue;
            }

            Misc.DrawPoint((RoadCreatorSettings.PointShape)roadCreator.settings.FindProperty("pointShape").intValue, point.transform.position, roadCreator.settings.FindProperty("pointSize").floatValue);
        }
        else
        {
            if (point.name == "Control Point")
            {
                Handles.color = prefabLine.settings.FindProperty("controlPointColour").colorValue;
            }
            else
            {
                Handles.color = prefabLine.settings.FindProperty("pointColour").colorValue;
            }

            Misc.DrawPoint((RoadCreatorSettings.PointShape)prefabLine.settings.FindProperty("pointShape").intValue, point.transform.position, prefabLine.settings.FindProperty("pointSize").floatValue);
        }
    }
Ejemplo n.º 46
0
        public static void pageHistory(string pluginid, Connector conn, ref Misc.PageElements pageElements, HttpRequest request, HttpResponse response)
        {
            switch (request.QueryString["2"])
            {
                default:
                    // Today
                    if (request.QueryString["image"] != null)
                    {
                        // Output a graph for todays, unless otherwise specified, data
                        int graphWidth = 800;
                        int graphHeight = 500;
                        if (request.QueryString["width"] != null && int.TryParse(request.QueryString["width"], out graphWidth) && graphWidth < 10)
                            graphWidth = 800;
                        if (request.QueryString["height"] != null && int.TryParse(request.QueryString["height"], out graphHeight) && graphHeight < 10)
                            graphHeight = 500;
                        int graphPaddingLeft = 45;
                        int graphPaddingBottom = 65;
                        int graphPaddingTop = 10;
                        int graphPaddingRight = 20;
                        Bitmap graph = new Bitmap(graphWidth, graphHeight);
                        Graphics g = Graphics.FromImage(graph);
                        g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                        g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                        g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

                        Pen penBlack = new Pen(new SolidBrush(Color.Black)); // Used for drawing gridlines
                        Pen penDataWatts = new Pen(new SolidBrush(Color.Red)); // Used for drawing the watts
                        Font fontGridlines = new Font("Times New Roman", 8.0f, FontStyle.Regular); // Used for drawing text for gridlines
                        Font fontLabels = new Font("Times New Roman", 12.0f, FontStyle.Regular);
                        SolidBrush brushGridlinesText = new SolidBrush(Color.Black);

                        // Draw border
                        g.DrawRectangle(new Pen(new SolidBrush(Color.Gray)), 0, 0, graphWidth -1, graphHeight - 1);

                        // Draw Y line
                        g.DrawLine(penBlack, graphPaddingLeft, graphPaddingTop, graphPaddingLeft, graphHeight - graphPaddingBottom);
                        // Draw X line
                        g.DrawLine(penBlack, graphPaddingLeft, graphHeight - graphPaddingBottom, graphWidth - graphPaddingRight, graphHeight - graphPaddingBottom);

                        // Get the max value
                        int year = -1, month = -1, day = -1;
                        string rawYear = request.QueryString["year"];
                        string rawMonth = request.QueryString["month"];
                        string rawDay = request.QueryString["day"];
                        if (rawYear != null && int.TryParse(rawYear, out year) && year != -1 && year < 2000)
                            year = -1;
                        if (rawMonth != null && int.TryParse(rawMonth, out month) && month != -1 && month < 1 && month > 12)
                            month = -1;
                        if (rawDay != null && int.TryParse(rawDay, out day) && day != -1 && day < 1 && day > 31)
                            day = -1;
                        Result maxVal = conn.Query_Read("SELECT MAX(watts) AS watts FROM cc128_readings WHERE DATE(datetime) = " + (year != -1 && month != -1 && day != -1 ? "'" + year + "-" + month + "-" + day + "'" : "CURDATE()"));
                        if (maxVal.Rows.Count != 1 || maxVal[0]["watts"].Length == 0)
                        {
                            g.FillRectangle(new SolidBrush(Color.Red), 0, 0, graphWidth, graphHeight);
                            g.DrawString("No data available...check the CC128 is operational!\r\n\r\nIs it on COM1?\r\nDid you unplug it?\r\nIs there an issue with the database or server?", new Font("Times New Roman", 20.0f, FontStyle.Regular), new SolidBrush(Color.White), 5, 5);
                        }
                        else
                        {
                            int maxValue = int.Parse(maxVal[0]["watts"]);
                            // Calculate the area for plotting
                            double plotWidth = graphWidth - (graphPaddingLeft + graphPaddingRight);
                            double plotHeight = graphHeight - (graphPaddingTop + graphPaddingBottom);
                            double numberOfYGridLines = 10;
                            // Calculate the gap between watts/time from 0 to maxvalue within plot area
                            double steppingY = plotHeight / numberOfYGridLines;//plotHeight / (double)maxValue * (maxValue * 0.05); // Watts
                            double steppingX = plotWidth / 24; // Time - pretty much 24 hours (CEIL: 23.999999->24)

                            // Shared variables
                            int txtX, txtY;
                            SizeF txtSize;
                            string txt;

                            // Draw watt label
                            txtSize = g.MeasureString("Watts", fontLabels);
                            txtX = -(int)(txtSize.Width / 2);
                            txtY = graphHeight / 2;
                            g.TranslateTransform(txtX + (txtSize.Width / 2), txtY + (txtSize.Height / 2));
                            g.RotateTransform(270);
                            g.DrawString("Watts", fontLabels, brushGridlinesText, 0, 0);
                            g.ResetTransform();

                            // Draw watt grid lines
                            for (double i = 0; i <= plotHeight; i += steppingY)
                            {

                                g.DrawLine(penBlack, graphPaddingLeft - 4, (graphPaddingTop + (int)plotHeight) - (int)i, graphWidth - graphPaddingRight, (graphPaddingTop + (int)plotHeight) - (int)i);

                                txt = Math.Round(i > 0 ? maxValue * (i / plotHeight) : 0, 0).ToString();
                                txtSize = g.MeasureString(txt.ToString(), fontGridlines);
                                txtX = (graphPaddingLeft - 4) - (int)txtSize.Width;
                                txtY = ((graphPaddingTop + (int)plotHeight) - (int)i) - (int)(txtSize.Height / 2);

                                g.DrawString(txt, fontGridlines, brushGridlinesText, txtX, txtY);
                            }

                            // Draw time label
                            txtSize = g.MeasureString("Time", fontLabels);
                            g.DrawString("Time", fontLabels, brushGridlinesText, (graphWidth / 2) - (txtSize.Width / 2), graphHeight - txtSize.Height);

                            // Draw time grid lines
                            for (double i = 0; i <= plotWidth; i += steppingX)
                            {
                                g.DrawLine(penBlack, graphPaddingLeft + (int)i, graphPaddingTop, graphPaddingLeft + (int)i, graphHeight - (graphPaddingBottom - 4));

                                txt = i == 24 ? "23:59" : Math.Round(i > 0 ? (i / plotWidth) * 24 : 0, 0).ToString("0#") + ":00";
                                txtSize = g.MeasureString(txt, fontGridlines);
                                txtX = graphPaddingLeft + (int)i;
                                txtY = graphHeight - (graphPaddingBottom - 4);

                                g.TranslateTransform(txtX + (txtSize.Width / 2), txtY + (txtSize.Height / 2));
                                g.RotateTransform(270);
                                g.DrawString(txt, fontGridlines, brushGridlinesText, -txtSize.Width, -txtSize.Height);
                                g.ResetTransform();
                            }

                            // Plot data
                            int lastX = 0;
                            int lasty = 0;
                            int newX, newY;
                            double seconds;
                            DateTime secondsStart = year != -1 && month != -1 && day != -1 ? DateTime.Parse(year + "-" + month + "-" + day) : DateTime.Today;
                            foreach (ResultRow reading in conn.Query_Read("SELECT watts, datetime FROM cc128_readings WHERE DATE(datetime) = " + (year != -1 && month != -1 && day != -1 ? "'" + year + "-" + month + "-" + day + "'" : "CURDATE()")))
                            {
                                seconds = DateTime.Parse(reading["datetime"]).Subtract(secondsStart).TotalSeconds; // 86400 seconds in a day
                                newX = (int)((seconds / 86400) * plotWidth);
                                newY = (int)(((double)int.Parse(reading["watts"]) / (double)maxValue) * plotHeight);
                                g.DrawLine(penDataWatts, graphPaddingLeft + (lastX != 0 ? lastX : newX - 1), (int)(graphPaddingTop + plotHeight) - (lasty != 0 ? lasty : newY), graphPaddingLeft + newX, (int)(graphPaddingTop + plotHeight) - newY);
                                lastX = newX;
                                lasty = newY;
                            }
                        }
                        g.Dispose();
                        response.ContentType = "image/png";
                        graph.Save(response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
                        response.End();
                    }
                    else
                    {
                        StringBuilder itemsDay = new StringBuilder();
                        for (int i = 1; i <= 32; i++)
                            itemsDay.Append("<option").Append(i == DateTime.Now.Day ? " selected=\"selected\">" : ">").Append(i).Append("</option>");
                        StringBuilder itemsMonth = new StringBuilder();
                        for (int i = 1; i <= 12; i++)
                            itemsMonth.Append("<option value=\"").Append(i).Append("\"").Append(i == DateTime.Now.Month ? " selected=\"selected\">" : ">").Append(DateTime.Parse("2000-" + i + "-01").ToString("MMMM")).Append("</option>");
                        StringBuilder itemsYear = new StringBuilder();
                        for (int i = DateTime.Now.AddYears(-5).Year; i <= DateTime.Now.Year; i++)
                            itemsYear.Append("<option").Append(i == DateTime.Now.Year ? " selected=\"selected\">" : ">").Append(i).Append("</option>");
                        // Output the content to display an image (above) of todays data
                        pageElements["CC128_CONTENT"] = Core.templates["cc128"]["history_today"]
                            .Replace("%ITEMS_DAY%", itemsDay.ToString())
                            .Replace("%ITEMS_MONTH%", itemsMonth.ToString())
                            .Replace("%ITEMS_YEAR%", itemsYear.ToString())
                            ;
                        pageElements["CC128_TITLE"] = "History - Today";
                        pageElements.setFlag("CC128_H_TODAY");
                    }
                    break;
                case "month":
                    // Month
                    string monthCurr = DateTime.Now.Year + "-" + DateTime.Now.Month + "-01";
                    // Get the max value for the month
                    Result monthMaxVal = conn.Query_Read("SELECT AVG(watts) AS watts FROM cc128_readings WHERE datetime >= '" + Utils.Escape(monthCurr) + "' ORDER BY watts DESC LIMIT 1");
                    if (monthMaxVal.Rows.Count != 1 || monthMaxVal[0]["watts"].Length == 0)
                        pageElements["CC128_CONTENT"] = "<p>No data available.</p>";
                    else
                    {
                        double maxValue = double.Parse(monthMaxVal[0]["watts"]);
                        // Process every day
                        StringBuilder monthBars = new StringBuilder();
                        double percent;
                        foreach (ResultRow day in conn.Query_Read("SELECT AVG(watts) AS watts, DAY(datetime) AS day FROM cc128_readings WHERE datetime >= '" + Utils.Escape(monthCurr) + "' GROUP BY DATE(datetime)"))
                        {
                            percent = Math.Floor(100 * (double.Parse(day["watts"]) / maxValue));
                            monthBars.Append(
                                Core.templates["cc128"]["history_bar"]
                                .Replace("%TITLE%", int.Parse(day["day"]).ToString("0#") + " - " + day["watts"] + " watts average")
                                .Replace("%PERCENT%", (percent > 100 ? 100 : percent).ToString())
                                );
                        }
                        pageElements["CC128_CONTENT"] = Core.templates["cc128"]["history_month"]
                        .Replace("%ITEMS%", monthBars.ToString())
                        ;
                    }
                    pageElements["CC128_TITLE"] = "History - This Month";
                    pageElements.setFlag("CC128_H_MONTH");
                    break;
                case "year":
                    // Year
                    // Get the max value for the month
                    Result yearMaxVal = conn.Query_Read("SELECT AVG(watts) AS watts FROM cc128_readings WHERE YEAR(datetime) = YEAR(NOW()) GROUP BY MONTH(datetime) ORDER BY watts DESC LIMIT 1");
                    if (yearMaxVal.Rows.Count != 1)
                        pageElements["CC128_CONTENT"] = "<p>No data available.</p>";
                    else
                    {
                        double maxValue = double.Parse(yearMaxVal[0]["watts"]);
                        // Process every day
                        StringBuilder yearBars = new StringBuilder();
                        double percent;
                        foreach (ResultRow day in conn.Query_Read("SELECT AVG(watts) AS watts, MONTH(DATETIME) AS month  FROM cc128_readings WHERE YEAR(datetime) = YEAR(NOW()) GROUP BY MONTH(datetime)"))
                        {
                            percent = Math.Floor(100 * (double.Parse(day["watts"]) / maxValue));
                            yearBars.Append(
                                Core.templates["cc128"]["history_bar"]
                                .Replace("%TITLE%", DateTime.Parse(DateTime.Now.Year + "-" + day["month"] + "-01").ToString("MMMM") + " - " + day["watts"] + " watts average")
                                .Replace("%PERCENT%", (percent > 100 ? 100 : percent).ToString())
                                );
                        }
                        pageElements["CC128_CONTENT"] = Core.templates["cc128"]["history_month"]
                        .Replace("%ITEMS%", yearBars.ToString())
                        ;
                    }
                    pageElements["CC128_TITLE"] = "History - This Year";
                    pageElements.setFlag("CC128_H_YEAR");
                    break;
                case "all":
                    // All
                    Result general = conn.Query_Read("SELECT COUNT('') AS total, AVG(watts) AS average FROM cc128_readings");
                    Result allMax = conn.Query_Read("SELECT MAX(watts) AS watts, datetime FROM cc128_readings GROUP BY datetime ORDER BY watts DESC LIMIT 1");
                    Result allMin = conn.Query_Read("SELECT MIN(NULLIF(watts, 0)) AS watts, datetime FROM cc128_readings GROUP BY datetime ORDER BY watts ASC LIMIT 1"); // Thank-you to http://stackoverflow.com/questions/2099720/mysql-find-min-but-not-zero for pro-tip <3
                    pageElements["CC128_CONTENT"] = Core.templates["cc128"]["history_all"]
                        .Replace("%TOTAL%", HttpUtility.HtmlEncode(general.Rows.Count == 1 ? general[0]["total"] : "Unavailable"))
                        .Replace("%MAX_WATTS%", HttpUtility.HtmlEncode(allMax.Rows.Count == 1 ? allMax[0]["watts"] : "Unavailable"))
                        .Replace("%MAX_DATE%", HttpUtility.HtmlEncode(allMax.Rows.Count == 1 ? allMax[0]["datetime"] : "Unavailable"))
                        .Replace("%MIN_WATTS%", HttpUtility.HtmlEncode(allMin.Rows.Count == 1 ? allMin[0]["watts"] : "Unavailable"))
                        .Replace("%MIN_DATE%", HttpUtility.HtmlEncode(allMin.Rows.Count == 1 ? allMin[0]["datetime"] : "Unavailable"))
                        .Replace("%AVERAGE%", HttpUtility.HtmlEncode(general.Rows.Count == 1 ? general[0]["average"] : "Unavailable"))
                        ;
                    pageElements["CC128_TITLE"] = "History - All";
                    break;
            }
        }
Ejemplo n.º 47
0
		public static AbstractType LookupIdRawly(Misc.ParseCacheView parseCache, ISyntaxRegion o, DModule oContext)
		{
			if (parseCache == null)
				throw new ArgumentNullException ("parseCache");
			if (o == null)
				throw new ArgumentNullException ("o");

			var ctxt = new ResolutionContext (parseCache, null, oContext, o.Location);

			/*
			 * Stuff like std.stdio.someSymbol should be covered by this already
			 */
			ctxt.ContextIndependentOptions = 
				ResolutionOptions.DontResolveBaseTypes | 
				ResolutionOptions.IgnoreAllProtectionAttributes | 
				ResolutionOptions.IgnoreDeclarationConditions | 
				ResolutionOptions.NoTemplateParameterDeduction | 
				ResolutionOptions.ReturnMethodReferencesOnly;

			AbstractType res;

			var td = o as ITypeDeclaration;
			var x = o as IExpression;

			if (td != null)
				res = TypeDeclarationResolver.ResolveSingle (td, ctxt, false);
			else if (x != null)
				res = ExpressionTypeEvaluation.EvaluateType (x, ctxt, false);
			else
				return null;

			if(res != null)
				return res;


			IntermediateIdType id;

			if (td != null)
				id = td.InnerMost as IntermediateIdType;
			else
				id = x as IntermediateIdType;

			if (id == null)
				return null;

			var l = new List<AbstractType> ();

			foreach (var pack in parseCache.EnumRootPackagesSurroundingModule(oContext)) {
				if (pack == null)
					continue;
				
				foreach (DModule mod in pack) {
					if (mod == null)
						continue;

					var children = mod [id.IdHash];
					if (children != null)
						foreach (var n in children)
							l.Add (TypeDeclarationResolver.HandleNodeMatch (n, ctxt, null, id));
				}
			}

			return AmbiguousType.Get(l);
		}
 private void SoundPlayerStateChanged(Misc.SoundState soundState, Misc.SoundState newState)
 {
     if (newState == Misc.SoundState.Stopped)
     Dispatcher.BeginInvoke(() =>
     {
       reorderListBoxSounds.ItemsSource = null;
       reorderListBoxSounds.ItemsSource = editorViewModel.Sounds;
     });
 }
Ejemplo n.º 49
0
 public static void handleRequest(string pluginid, Connector conn, ref Misc.PageElements pageElements, HttpRequest request, HttpResponse response)
 {
     // Add headers - CSS and JS
     if (pageElements["HEADER"] == null) pageElements["HEADER"] = string.Empty;
     pageElements["HEADER"] += "<link href=\"" + pageElements["URL"] + "/Content/CSS/CC128.css\" type=\"text/css\" rel=\"Stylesheet\" />";
     pageElements["HEADER"] += "<script src=\"" + pageElements["URL"] + "/Content/JS/CC128.js\"></script>";
     // Determine which page the user wants
     string subPage = request.QueryString["1"];
     if (subPage != null && subPage == "history")
         pageHistory(pluginid, conn, ref pageElements, request, response);
     else if (subPage == "ajax")
     {
         // Write the last watt reading
         ResultRow lastReading = conn.Query_Read("SELECT (SELECT watts FROM cc128_readings WHERE datetime >= DATE_SUB(NOW(), INTERVAL 24 HOUR) ORDER BY datetime DESC LIMIT 1) AS last_reading, (SELECT MAX(watts) FROM cc128_readings WHERE datetime >= DATE_SUB(NOW(), INTERVAL 24 HOUR)) AS max_watts")[0];
         response.ContentType = "text/xml";
         response.Write("<d><w>" + lastReading["last_reading"] + "</w><m>" + lastReading["max_watts"] + "</m></d>");
         conn.Disconnect();
         response.End();
     }
     else
         pagePower(pluginid, conn, ref pageElements, request, response);
     // Set the base content
     pageElements["TITLE"] = "CC128 Energy Monitor - <!--CC128_TITLE-->";
     pageElements["CONTENT"] = Core.templates["cc128"]["base"];
 }
Ejemplo n.º 50
0
		public override void OnAttack(Misc.DamageAction action)
		{
			if (action.Victim is NPC && m_dmgBonusVsCreatureTypePct != null)
			{
				var bonus = m_dmgBonusVsCreatureTypePct[(int)((NPC)action.Victim).Entry.Type];
				if (bonus != 0)
				{
					action.Damage += (bonus * action.Damage + 50) / 100;
				}
			}
			base.OnAttack(action);
		}
Ejemplo n.º 51
0
 public static void pagePower(string pluginid, Connector conn, ref Misc.PageElements pageElements, HttpRequest request, HttpResponse response)
 {
     // Set JS onload event
     if (pageElements["BODY_ONLOAD"] == null) pageElements["BODY_ONLOAD"] = string.Empty;
     pageElements["BODY_ONLOAD"] += "cc128onLoad();";
     // Set meter content
     pageElements["CC128_CONTENT"] = Core.templates["cc128"]["power"];
     pageElements["CC128_TITLE"] = "Current Power Usage";
     pageElements.setFlag("CC128_CURR");
 }
Ejemplo n.º 52
0
        static void OnLoadingComplete(EventArgs args)
        {
            if (!_Player.ChampionName.Contains("Ziggs"))
            {
                return;
            }
            Chat.Print("Ziggs7 Loaded!", Color.Orange);
            Bootstrap.Init(null);
            Q      = new Spell.Skillshot(SpellSlot.Q, 850, SkillShotType.Circular, 300, 1700, 130);
            Q2     = new Spell.Skillshot(SpellSlot.Q, 1125, SkillShotType.Linear, 250 + Q.CastDelay, 1700, 130);
            Q3     = new Spell.Skillshot(SpellSlot.Q, 1400, SkillShotType.Linear, 300 + Q.CastDelay, 1700, 130);
            W      = new Spell.Skillshot(SpellSlot.W, 1000, SkillShotType.Circular, 250, 1750, 275);
            E      = new Spell.Skillshot(SpellSlot.E, 900, SkillShotType.Circular, 500, 1600, 90);
            R      = new Spell.Skillshot(SpellSlot.R, 5000, SkillShotType.Circular, 1000, 2800, 500);
            Ignite = new Spell.Targeted(ObjectManager.Player.GetSpellSlotFromName("summonerdot"), 600);
            Menu   = MainMenu.AddMenu("Ziggs7", "Ziggs");
            Menu.AddGroupLabel("Doctor7");
            Menu.AddGroupLabel("Leave Feedback For Any Bugs");
            ComboMenu = Menu.AddSubMenu("Combo Settings", "Combo");
            ComboMenu.AddGroupLabel("Combo Settings");
            ComboMenu.Add("ComboQ", new CheckBox("Use [Q] Combo"));
            ComboMenu.Add("ComboW", new CheckBox("Use [W] Combo", false));
            ComboMenu.Add("ComboE", new CheckBox("Use [E] Combo"));
            ComboMenu.AddGroupLabel("Ultimate Enemies In Count");
            ComboMenu.Add("ultiR", new CheckBox("Use [R] Enemies In Range", false));
            ComboMenu.Add("MinR", new Slider("Min Enemies Use [R]", 2, 1, 5));

            HarassMenu = Menu.AddSubMenu("Harass Settings", "Harass");
            HarassMenu.AddGroupLabel("Harass Settings");
            HarassMenu.Add("HarassQ", new CheckBox("Use [Q] Harass"));
            HarassMenu.Add("HarassE", new CheckBox("Use [E] Harass", false));
            HarassMenu.Add("ManaHR", new Slider("Mana For Harass", 40));

            LaneClearMenu = Menu.AddSubMenu("LaneClear Settings", "LaneClear");
            LaneClearMenu.AddGroupLabel("Lane Clear Settings");
            LaneClearMenu.Add("QLC", new CheckBox("Use [Q] LaneClear"));
            LaneClearMenu.Add("ELC", new CheckBox("Use [E] LaneClear", false));
            LaneClearMenu.Add("ManaLC", new Slider("Mana For LaneClear", 60));

            JungleClearMenu = Menu.AddSubMenu("JungleClear Settings", "JungleClear");
            JungleClearMenu.AddGroupLabel("JungleClear Settings");
            JungleClearMenu.Add("QJungle", new CheckBox("Use [Q] JungleClear"));
            JungleClearMenu.Add("WJungle", new CheckBox("Use [W] JungleClear"));
            JungleClearMenu.Add("EJungle", new CheckBox("Use [E] JungleClear"));
            JungleClearMenu.Add("ManaJC", new Slider("Mana For JungleClear", 30));

            KillStealMenu = Menu.AddSubMenu("KillSteal Settings", "KillSteal");
            KillStealMenu.AddGroupLabel("KillSteal Settings");
            KillStealMenu.Add("KsE", new CheckBox("Use [E] KillSteal", false));
            KillStealMenu.Add("KsQ", new CheckBox("Use [Q] KillSteal"));
            KillStealMenu.Add("KsW", new CheckBox("Use [W] KillSteal"));
            KillStealMenu.Add("ign", new CheckBox("Use [Ignite] KillSteal"));
            KillStealMenu.AddGroupLabel("Ultimate KillSteal");
            KillStealMenu.Add("KsR", new CheckBox("Use [R] KillSteal"));
            KillStealMenu.Add("minKsR", new Slider("Min [R] Distance KillSteal", 100, 1, 5000));
            KillStealMenu.Add("RKb", new KeyBind("[R] Semi Manual", false, KeyBind.BindTypes.HoldActive, 'T'));

            Misc = Menu.AddSubMenu("Misc Settings", "Misc");
            Misc.AddGroupLabel("Skin Settings");
            Misc.Add("checkSkin", new CheckBox("Use Skin Changer", false));
            Misc.Add("skin.Id", new ComboBox("Skin Mode", 0, "Default", "1", "2", "3", "4", "5"));
            Misc.AddGroupLabel("Drawing Settings");
            Misc.Add("DrawR", new CheckBox("[R] Range"));
            Misc.Add("DrawQ", new CheckBox("[Q] Range"));
            Misc.Add("DrawW", new CheckBox("[W] Range"));
            Misc.Add("DrawE", new CheckBox("[E] Range"));
            Misc.Add("Damage", new CheckBox("Damage Indicator [R]"));
            Misc.Add("Notifications", new CheckBox("Notifications Can Kill R"));
            Misc.AddGroupLabel("Interrupt Settings");
            Misc.Add("inter", new CheckBox("Use [W] Interupt"));
            Misc.Add("AntiGapW", new CheckBox("Use [W] AntiGapcloser", false));

            Drawing.OnDraw += Drawing_OnDraw;
            Game.OnTick    += Game_OnTick;
            Interrupter.OnInterruptableSpell += Interupt;
            Drawing.OnEndScene    += Damage;
            Gapcloser.OnGapcloser += Gapcloser_OnGapcloser;
        }
Ejemplo n.º 53
0
		public static void SearchNodesByName(int idToFind, DModule parseCacheContext, Misc.ParseCacheView pcw, out List<ModulePackage> foundPackages, out List<INode> foundItems)
		{
			foundItems = new List<INode>();
			foundPackages = new List<ModulePackage>();

			if(idToFind == 0)
				return;

			var currentList = new List<IBlockNode>();
			var nextList = new List<IBlockNode>();

			var currentPackageList = new List<ModulePackage>();
			var nextPackageList = new List<ModulePackage>();

			currentPackageList.AddRange(pcw.EnumRootPackagesSurroundingModule(parseCacheContext));

			while(currentPackageList.Count != 0)
			{
				foreach(var pack in currentPackageList)
				{
					currentList.AddRange (pack.GetModules());

					if(pack.NameHash == idToFind)
						foundPackages.Add(pack);

					nextPackageList.AddRange(pack);
				}

				if(nextPackageList.Count == 0)
					break;

				currentPackageList.Clear();
				currentPackageList.AddRange(nextPackageList);
				nextPackageList.Clear();
			}


			while (currentList.Count != 0) {

				foreach (var i in currentList) {
					var items = i[idToFind];
					if (items != null)
						foundItems.AddRange (items);

					foreach (var k in i)
						if (k is IBlockNode && !foundItems.Contains (k))
							nextList.Add (k as IBlockNode);
				}

				currentList.Clear ();
				currentList.AddRange (nextList);
				nextList.Clear ();
			}
		}
Ejemplo n.º 54
0
        public void Write(byte[] data)
        {
            if (data.Length == 0)
            {
                this.Log(LogLevel.Warning, "Unexpected write with no data");
                return;
            }

            this.Log(LogLevel.Noisy, "Write with {0} bytes of data: {1}", data.Length, Misc.PrettyPrintCollectionHex(data));
            registerAddress = (Registers)data[0];

            // length=1 preparing to read
            // length=3 one byte of data
            // (n*2)+2 burst write with n bytes

            // Skip the first byte as it contains register address
            // Must skip final byte, problem with I2C

            if (data.Length == 1)
            {
                this.Log(LogLevel.Noisy, "Preparing to read register {0} (0x{0:X})", registerAddress);
            }
            else if (data.Length == 3)
            {
                RegistersCollection.Write((byte)registerAddress, data[1]);
                this.Log(LogLevel.Noisy, "Writing one byte 0x{0:X} to register {1} (0x{1:X})", data[1], registerAddress);
            }
            else
            {
                // Burst write causes one extra trash byte to be transmitted in addition
                // to the extra I2C byte.
                this.Log(LogLevel.Noisy, "Burst write mode!");
                for (var i = 0; 2 * i < data.Length - 2; i++)
                {
                    RegistersCollection.Write(data[2 * i], data[2 * i + 1]);
                    this.Log(LogLevel.Noisy, "Writing 0x{0:X} to register {1} (0x{1:X})", data[2 * i + 1], (Registers)data[2 * i]);
                }
            }
        }
Ejemplo n.º 55
0
        /// <summary>
        /// For use with Append() and AppendLine()
        /// </summary>
        /// <param name="misc">The miscellaneous property to set.</param>
        /// <returns>This Paragraph with the last appended text changed by a miscellaneous property.</returns>
        /// <example>
        /// Append text to this Paragraph and then apply a miscellaneous property.
        /// <code>
        /// // Create a document.
        /// using (DocX document = DocX.Create(@"Test.docx"))
        /// {
        ///     // Insert a new Paragraph.
        ///     Paragraph p = document.InsertParagraph();
        ///
        ///     p.Append("I am ")
        ///     .Append("outlined").Misc(Misc.outline)
        ///     .Append(" I am not");
        ///        
        ///     // Save this document.
        ///     document.Save();
        /// }// Release this document from memory.
        /// </code>
        /// </example>
        public Paragraph Misc(Misc misc)
        {
            switch (misc)
            {
                case Novacode.Misc.none:
                    break;

                case Novacode.Misc.outlineShadow:
                    {
                        ApplyTextFormattingProperty(XName.Get("outline", DocX.w.NamespaceName), string.Empty, null);
                        ApplyTextFormattingProperty(XName.Get("shadow", DocX.w.NamespaceName), string.Empty, null);

                        break;
                    }

                case Novacode.Misc.engrave:
                    {
                        ApplyTextFormattingProperty(XName.Get("imprint", DocX.w.NamespaceName), string.Empty, null);

                        break;
                    }

                default:
                    {
                        ApplyTextFormattingProperty(XName.Get(misc.ToString(), DocX.w.NamespaceName), string.Empty, null);

                        break;
                    }
            }

            return this;
        }
        public async Task ExecuteAsync(DiscoveryContext context, TextWriter log)
        {
            var cakeContribRepositories = await context.GithubClient.Repository.GetAllForUser(Constants.CAKE_CONTRIB_REPO_OWNER).ConfigureAwait(false);

            context.Addins = await context.Addins
                             .ForEachAsync(
                async addin =>
            {
                // Some addins were moved to the cake-contrib organization but the URL in their package metadata still
                // points to the original repo. This step corrects the URL to ensure it points to the right repo
                var repo = cakeContribRepositories.FirstOrDefault(r => r.Name.EqualsIgnoreCase(addin.Name));
                if (repo != null)
                {
                    // Only overwrite GitHub and Bitbucket URLs and preserve custom URLs such as 'https://cakeissues.net/' for example.
                    if (addin.ProjectUrl.IsGithubUrl(false) || addin.ProjectUrl.IsBitbucketUrl())
                    {
                        addin.ProjectUrl = new Uri(repo.HtmlUrl);
                    }

                    addin.InferredRepositoryUrl = new Uri(repo.CloneUrl);
                }

                // Derive the repository name and owner
                var ownershipDerived = Misc.DeriveGitHubRepositoryInfo(addin.InferredRepositoryUrl ?? addin.RepositoryUrl ?? addin.ProjectUrl, out string repoOwner, out string repoName);
                if (ownershipDerived)
                {
                    addin.RepositoryOwner = repoOwner;
                    addin.RepositoryName  = repoName;
                }

                // Validate GitHub URL
                if (repo == null && ownershipDerived)
                {
                    try
                    {
                        var repository = await context.GithubClient.Repository.Get(repoOwner, repoName).ConfigureAwait(false);

                        // Only overwrite GitHub and Bitbucket URLs and preserve custom URLs such as 'https://cakeissues.net/' for example.
                        if (addin.ProjectUrl.IsGithubUrl(false) || addin.ProjectUrl.IsBitbucketUrl())
                        {
                            addin.ProjectUrl = new Uri(repository.HtmlUrl);
                        }

                        addin.InferredRepositoryUrl = new Uri(repository.CloneUrl);

                        // Derive the repository name and owner with the new repo URL
                        if (Misc.DeriveGitHubRepositoryInfo(addin.InferredRepositoryUrl, out repoOwner, out repoName))
                        {
                            addin.RepositoryOwner = repoOwner;
                            addin.RepositoryName  = repoName;
                        }
                    }
                    catch (NotFoundException)
                    {
                        addin.ProjectUrl = null;
                    }
#pragma warning disable CS0168 // Variable is declared but never used
                    catch (Exception e)
#pragma warning restore CS0168 // Variable is declared but never used
                    {
                        throw;
                    }
                }

                // Validate non-GitHub URL
                if (addin.ProjectUrl != null && !addin.ProjectUrl.IsGithubUrl(false))
                {
                    var githubRequest = new Request()
                    {
                        BaseAddress = new UriBuilder(addin.ProjectUrl.Scheme, addin.ProjectUrl.Host, addin.ProjectUrl.Port).Uri,
                        Endpoint    = new Uri(addin.ProjectUrl.PathAndQuery, UriKind.Relative),
                        Method      = HttpMethod.Head,
                    };
                    githubRequest.Headers.Add("User-Agent", ((Connection)context.GithubClient.Connection).UserAgent);

                    var response = await SendRequestWithRetries(githubRequest, context.GithubHttpClient).ConfigureAwait(false);

                    if (response.StatusCode == HttpStatusCode.NotFound)
                    {
                        addin.ProjectUrl = null;
                    }
                }

                // Standardize GitHub URLs
                addin.InferredRepositoryUrl = Misc.StandardizeGitHubUri(addin.InferredRepositoryUrl);
                addin.RepositoryUrl         = Misc.StandardizeGitHubUri(addin.RepositoryUrl);
                addin.ProjectUrl            = Misc.StandardizeGitHubUri(addin.ProjectUrl);

                return(addin);
            }, Constants.MAX_GITHUB_CONCURENCY)
                             .ConfigureAwait(false);
        }
Ejemplo n.º 57
0
 private void Start()
 {
     StartCoroutine(Misc.LoopWithDelay(level.spawnDelaySec, level.SpawnCar));
 }
Ejemplo n.º 58
0
        public override void Update(AI ai, Game game, Player player, PlayerInfo playerInfo, int tick)
        {
            if (mineralType == Map.Minerals.None)
            {
                Kill(ai);
                return;
            }

            uint spot          = 0;
            int  maxGeologists = ai.HardTimes ? 2 : 2 + (int)(ai.GameTime / ((45 - Misc.Max(ai.GoldFocus, ai.SteelFocus) * 5) * Global.TICKS_PER_MIN));
            var  mineType      = MineTypes[(int)mineralType - 1];
            var  largeSpots    = AI.GetMemorizedMineralSpots(mineralType, true)
                                 .Where(mineralSpot => game.Map.HasOwner(mineralSpot) && game.Map.GetOwner(mineralSpot) == player.Index).ToList();
            var smallSpots = AI.GetMemorizedMineralSpots(mineralType, false)
                             .Where(mineralSpot => game.Map.HasOwner(mineralSpot) && game.Map.GetOwner(mineralSpot) == player.Index && !largeSpots.Contains(mineralSpot)).ToList();
            bool considerSmallSpots = (ai.GameTime > 120 * Global.TICKS_PER_MIN + playerInfo.Intelligence * 30 * Global.TICKS_PER_MIN) || ai.StupidDecision();

            if (ai.HardTimes && ((smallSpots.Count > 0 && ai.GameTime >= 60 * Global.TICKS_PER_MIN) || (smallSpots.Count > 3 && ai.GameTime >= 35 * Global.TICKS_PER_MIN)))
            {
                considerSmallSpots = true;
            }

            while (true)
            {
                bool canBuild = CanBuild(game, player);

                if (!canBuild)
                {
                    ai.PushState(ai.CreateState(AI.State.CraftTool, Resource.Type.Pick));
                    break;
                }

                // look for memorized large spot
                if (largeSpots.Count > 0)
                {
                    int index = game.GetRandom().Next() % largeSpots.Count;
                    spot = largeSpots[index];

                    if (CanBuildAtSpot(game, player, spot, 1 + (int)ai.GameTime / (60 * Global.TICKS_PER_MIN)) && game.BuildBuilding(spot, mineType, player))
                    {
                        Kill(ai);
                        break;
                    }

                    largeSpots.RemoveAt(index);
                }
                else if (considerSmallSpots && smallSpots.Count > 0)
                {
                    int index = game.GetRandom().Next() % smallSpots.Count;
                    spot = smallSpots[index];

                    if (CanBuildAtSpot(game, player, spot, 1 + (int)ai.GameTime / (60 * Global.TICKS_PER_MIN)) && game.BuildBuilding(spot, mineType, player))
                    {
                        Kill(ai);
                        break;
                    }

                    smallSpots.RemoveAt(index);
                }
                else if (largeSpots.Count < 6)
                {
                    // no valid mineral spots found -> send geologists
                    var geologists = game.GetPlayerSerfs(player).Where(serf => serf.SerfType == Serf.Type.Geologist).ToList();

                    if (geologists.Count == 0) // no geologists? try to train them
                    {
                        if (!SendGeologist(ai, game, player))
                        {
                            // TODO: what should we do then? -> try to craft a hammer? wait for generics? abort?
                            Kill(ai);
                            ai.CreateRandomDelayedState(AI.State.FindMinerals, 10000, (120 - (int)playerInfo.Intelligence) * 2000, mineralType);
                            return;
                        }
                    }
                    else
                    {
                        int totalGeologistCount = geologists.Count;
                        geologists = geologists.Where(g => g.SerfState == Serf.State.IdleInStock).ToList();
                        int sentOutGeologistCount = totalGeologistCount - geologists.Count;

                        if (geologists.Count > 0 && sentOutGeologistCount < maxGeologists)
                        {
                            if (!SendGeologist(ai, game, player))
                            {
                                // TODO: what should we do then? -> try to craft a hammer? wait for generics? abort?
                                Kill(ai);
                                return;
                            }
                        }
                        else // this means there are geologists but none in stock (so they are already looking for minerals) or 2 or more are already looking for minerals
                        {
                            Kill(ai);
                            // check again in a while
                            ai.CreateRandomDelayedState(AI.State.FindMinerals, 30000, (120 - (int)playerInfo.Intelligence) * 2000, mineralType);
                            return;
                        }
                    }

                    break;
                }
            }

            Kill(ai);
        }
Ejemplo n.º 59
0
 public void ShowMessage(Misc.MessageType type, string message)
 {
     lblError.Text = message;
     switch (type)
     {
         case Misc.MessageType.Error:
             lblError.CssClass = "error";
             break;
         case Misc.MessageType.Success:
             lblError.CssClass = "message";
             break;
     }
 }
Ejemplo n.º 60
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            //CleanUpFiles
            try
            {
                Misc.CleanUpFiles(Directory.GetCurrentDirectory(), "*.old");
            }
            catch (Exception ex)
            {
                MsgBox.ShowMessage(
                    $"Warning: Error during files clean-up. Error message: {ex.Message}",
                    @"Celeste Fan Project",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            //Update Check
            try
            {
                if (await UpdaterForm.GetGitHubVersion() > Assembly.GetExecutingAssembly().GetName().Version)
                {
                    using (var form =
                               new MsgBoxYesNo(
                                   @"An update is avalaible. Click ""Yes"" to install it, or ""No"" to ignore it (not recommended).")
                           )
                    {
                        var dr = form.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            using (var form2 = new UpdaterForm())
                            {
                                form2.ShowDialog();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowMessage(
                    $"Warning: Error during update check. Error message: {ex.Message}",
                    @"Celeste Fan Project",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            //Auto Login
            if (Program.UserConfig?.LoginInfo == null)
            {
                return;
            }

            if (!Program.UserConfig.LoginInfo.AutoLogin)
            {
                return;
            }

            panelManager1.Enabled = false;
            try
            {
                var response = await Program.WebSocketApi.DoLogin(Program.UserConfig.LoginInfo.Email,
                                                                  Program.UserConfig.LoginInfo.Password);

                if (response.Result)
                {
                    Program.CurrentUser = response.User;

                    gamerCard1.UserName = $@"{Program.CurrentUser.ProfileName}";
                    gamerCard1.Rank     = $@"{Program.CurrentUser.Rank}";

                    panelManager1.SelectedPanel = managedPanel1;
                }
            }
            catch (Exception)
            {
                //
            }
            panelManager1.Enabled = true;
        }