Esempio n. 1
0
        public void Watch()
        {
            if (m_Watching)
            {
                byte[] playerList = GetPlayerListMemoryBlock();
                for (int i = 0; i < MAX_PLAYERS; i++)
                {
                    if (playerList[i * MemoryAddresses.PLAYER_STRUCT_SIZE] == 1)//in server
                    {
                        HQMTeam t = (HQMTeam)playerList[i * MemoryAddresses.PLAYER_STRUCT_SIZE + MemoryAddresses.TEAM_OFFSET];

                        IEnumerable <byte> namebytes = playerList.Skip(i * MemoryAddresses.PLAYER_STRUCT_SIZE + 0x14).Take(0x18);
                        string             name      = Encoding.ASCII.GetString(namebytes.ToArray()).Split('\0')[0];

                        if (t != HQMTeam.NoTeam && (int)t != 255) //if on the ice
                        {
                            if (!OnRightTeam(t, name, i))
                            {
                                int team = (int)t;
                                while (team != 255)
                                {
                                    ForceLeaveIce(i);
                                    team = MemoryEditor.ReadBytes(MemoryAddresses.PLAYER_LIST_ADDRESS + i * MemoryAddresses.PLAYER_STRUCT_SIZE + MemoryAddresses.TEAM_OFFSET, 1)[0];
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 void TeamTouchedPuck()
 {
     foreach (Player p in PlayerManager.Players)
     {
         if ((p.StickPosition - Puck.Position).Magnitude < 0.25f)
         {
             TeamTouch   = p.Team;
             PlayerTouch = p;
             if (TeamTouch == HQMTeam.Blue && p.Name != BQueue.ElementAt(2))
             {
                 if (GameInfo.GameTime > 0 && GameInfo.StopTime == 0)
                 {
                     BQueue = QueueAdd(BQueue, p.Name);
                 }
             }
             if (TeamTouch == HQMTeam.Red && p.Name != RQueue.ElementAt(2))
             {
                 if (GameInfo.GameTime > 0 && GameInfo.StopTime == 0)
                 {
                     RQueue = QueueAdd(RQueue, p.Name);
                 }
             }
         }
     }
 }
Esempio n. 3
0
        public void AddPlayerToTeam(string name, HQMTeam team)
        {
            RankedPlayer p;

            if (m_LoggedInPlayers.TryGetValue(name, out p))
            {
                p.Team = team;
            }
            else
            {
                throw new InvalidOperationException("Could not add " + name + "to " + team);
            }
        }
Esempio n. 4
0
        private bool OnRightTeam(HQMTeam t, string name, int slot)
        {
            RankedPlayer p = m_Context.GetPlayer(name);

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

            else
            {
                return(m_Context.IsLoggedIn(name, slot) &&
                       ((t == HQMTeam.Blue && p.Team == HQMTeam.Blue) ||
                        (t == HQMTeam.Red && p.Team == HQMTeam.Red)));
            }
        }
Esempio n. 5
0
        public void checkForAssists()
        {
            puckTouched = true;

            if (teamTouchedPuck() == HQMTeam.NoTeam)
            {
                puckTouched = false;
            }

            if (puckTouched)
            {
                lastTouchedPuck = teamTouchedPuck();
            }

            if (lastTouchedPuck == HQMTeam.Red)
            {
                blueCount = 0; //resets the other teams counter, since they have no more possesion

                if (redCount == 4)
                {
                    redCount = 0;
                }

                tempAssis = playerTouchedPuck();


                if (tempAssis != "")
                {
                    if (redCount == 0)
                    {
                        assisters[redCount] = tempAssis;
                        redCount++;
                    }
                    else if (assisters[redCount - 1] != tempAssis)
                    {
                        if (redCount == 2 && assisters[redCount - 2] != tempAssis)
                        {
                            assisters[redCount] = tempAssis;
                            redCount++;
                        }
                    }
                }

                if (GameInfo.AfterGoalFaceoffTime != 0)
                {
                    if (redCount == 3)
                    {
                        theHeroOfThePlay = assisters[0];
                        Chat.SendMessage("THIRD ASSIST: " + theHeroOfThePlay);
                        redCount = 0;
                        //TODO: Add a function to add an assist to the player who got 3rd assist. Currently only GET available in HockeyDedicated
                    }
                }
            }
            else if (lastTouchedPuck == HQMTeam.Blue)
            {
                redCount = 0; //resets the other teams counter, since they have no more possesion

                if (blueCount == 4)
                {
                    blueCount = 0;
                }

                tempAssis = playerTouchedPuck();


                if (tempAssis != "")
                {
                    if (blueCount == 0)
                    {
                        assisters[blueCount] = tempAssis;
                        blueCount++;
                    }
                    else if (assisters[blueCount - 1] != tempAssis)
                    {
                        if (blueCount == 2 && assisters[blueCount - 2] != tempAssis)
                        {
                            assisters[blueCount] = tempAssis;
                            blueCount++;
                        }
                        else if (blueCount != 2)
                        {
                            assisters[blueCount] = tempAssis;
                            blueCount++;
                        }
                    }
                }

                System.Console.WriteLine(blueCount);

                if (GameInfo.AfterGoalFaceoffTime != 0)
                {
                    if (blueCount == 3)
                    {
                        theHeroOfThePlay = assisters[0];
                        Chat.SendMessage("THIRD ASSIST: " + theHeroOfThePlay);
                        blueCount = 0;
                        //TODO: Add a function to add an assist to the player who got 3rd assist. Currently only GET available in HockeyDedicated
                    }
                }
            }
        }