예제 #1
0
        public static int GetStepWeight(NSNotes note)
        {
            switch (note)
            {
            case NSNotes.Mine:
                return(-8);

            case NSNotes.Miss:
                return(-8);

            case NSNotes.Barely:
                return(-4);

            case NSNotes.Great:
                return(1);

            case NSNotes.Perfect:
            case NSNotes.Flawless:
                return(2);

            case NSNotes.Held:
                return(6);

            default:
                return(0);
            }
        }
예제 #2
0
파일: Func.cs 프로젝트: Wayfur/OpenSMO
 public static int GetStepWeight(NSNotes note)
 {
     switch (note) {
         case NSNotes.Mine: return -8;
         case NSNotes.Miss: return -8;
         case NSNotes.Barely: return -4;
         case NSNotes.Great: return 1;
         case NSNotes.Perfect:
         case NSNotes.Flawless: return 2;
         case NSNotes.Held: return 6;
         default: return 0;
     }
 }
예제 #3
0
파일: User.cs 프로젝트: jkalter11/OpenSMO
        // User sends a game status update (game passes a step)
        public void NSCGSU()
        {
            if (!RequiresAuthentication())
            {
                return;
            }

            if (Playing && !Spectating)
            {
                NSNotes  gsuCtr;
                NSGrades gsuGrade;
                int      gsuScore, gsuCombo, gsuLife;
                double   gsuOffset;

                gsuCtr        = (NSNotes)ez.Read1();
                gsuGrade      = (NSGrades)(ez.Read1() / 16);
                gsuScore      = ez.Read4();
                gsuCombo      = ez.Read2();
                gsuLife       = ez.Read2();
                NoteOffsetRaw = ez.ReadU2();
                gsuOffset     = NoteOffsetRaw / 2000d - 16.384d;

                if (User_Protocol == 2)
                {
                    gsuCtr += 2;
                }

                NoteHit    = gsuCtr;
                NoteOffset = gsuOffset;

                Notes[(int)gsuCtr]++;
                Grade = gsuGrade;
                Score = gsuScore;
                Combo = gsuCombo;

                if (gsuCombo > MaxCombo)
                {
                    MaxCombo = gsuCombo;
                }
            }
            else
            {
                ez.Discard();
            }
        }
예제 #4
0
파일: User.cs 프로젝트: Supermale/OpenSMO
        public void NSCGSU()
        {
            if (!RequiresAuthentication()) return;

            if (Playing && !Spectating) {
                NSNotes gsuCtr;
                NSGrades gsuGrade;
                int gsuScore, gsuCombo, gsuLife;
                double gsuOffset;

                gsuCtr = (NSNotes)ez.Read1();
                gsuGrade = (NSGrades)(ez.Read1() / 16);
                gsuScore = ez.Read4();
                gsuCombo = ez.Read2();
                gsuLife = ez.Read2();
                NoteOffsetRaw = ez.ReadU2();
                gsuOffset = NoteOffsetRaw / 2000d - 16.384d;

                NoteHit = gsuCtr;
                NoteOffset = gsuOffset;

                Notes[(int)gsuCtr]++;
                Grade = gsuGrade;
                Score = gsuScore;
                Combo = gsuCombo;

                if (gsuCombo > MaxCombo)
                    MaxCombo = gsuCombo;
            } else
                ez.Discard();
        }
예제 #5
0
파일: User.cs 프로젝트: SandonV/OpenSMO
        public void NSCGSU()
        {
            if (!RequiresAuthentication()) return;

            if ((Playing && !Spectating) && (this.CurrentRoom != null))
            {
            NSNotes gsuCtr;
            NSGrades gsuGrade;
            int gsuScore, gsuCombo, gsuLife;
            double gsuOffset;

            gsuCtr = (NSNotes)ez.Read1();
            gsuGrade = (NSGrades)(ez.Read1() / 16);
            gsuScore = ez.Read4();
            gsuCombo = ez.Read2();
            gsuLife = ez.Read2();
            NoteOffsetRaw = ez.ReadU2();
            gsuOffset = NoteOffsetRaw / 2000d - 16.384d;

            if (User_Protocol == 2)
                gsuCtr += 2;

            NoteHit = gsuCtr;
            NoteOffset = gsuOffset;
            NoteHit = (NSNotes)GetJudge((int)NoteHit, NoteOffset);

            //        MainClass.AddLog("NoteHit: " + NoteHit);
            //        MainClass.AddLog("NoteOffset: " + NoteOffset);
            //	timing = GetTiming((int)NoteHit, NoteOffset, timing);
            //	MainClass.AddLog(this.User_Name"'s Timing: " + timing);
            try
            {
                Notes[(int)NoteHit]++;
            }
            catch (Exception e)
            {
                MainClass.AddLog("gsuCtr:" + gsuCtr);
                foreach(var note in Notes)
                {
                    MainClass.AddLog(note.ToString());
                }
                SendChatMessage("Your client gave the server weird info and was kicked...");
                SendRoomChatMessage(this.User_Name + " has been kicked for sending bad data to the server");
                MainClass.AddLog(this.User_Name + " has been kicked for sending bad array to server");
                Kick();
                Console.WriteLine("{0} Exception caught.", e);

            }

            Grade = gsuGrade;
            Score = gsuScore;
            Combo = gsuCombo;

            servcombo = GetServCombo((int)NoteHit, servcombo);
            jump = Combo - servcombo;

            if (( jump > 3 ) || ( jump < 0 ))
            {
                jump=0;
            }

            servcombo = Combo;

            //	timing = GetTiming((int)NoteHit, NoteOffset, timing);

            perfmarv = GetPerfMarv((int)NoteHit, perfmarv, jump);
            if ( perfmarv > 249 )
            {
                toasty++;
            //		MainClass.AddLog("TOOOOOOOAAAAAAASSSSSSTYYYYYYYYYYYYY");
                perfmarv = 0;
            }

            if ( jump > 0 )
            {
                jumpxp = GetJumpCounts((int)NoteHit, jump, jumpxp);
            }

            if ((NoteOffset < 0.04509) && (NoteOffset > -.04509))
            {
                clientoffsetcount++;
                clientoffset += NoteOffset;
                if (NoteOffset < 0.0)
                {
                    offsetneg++;
                }
                if (NoteOffset > 0.0)
                {
                    offsetpos++;
                }
            }

            if (gsuCombo > MaxCombo)
                MaxCombo = gsuCombo;
            }
            else
            ez.Discard();
        }