Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region QuizShow (2068)
- case 2068:
- {
- const byte GiveAwaser = 3, Remove = 8;
- byte Typ = packet[4];
- var quizShow = Kernel.QuizShow;
- switch (Typ)
- {
- case GiveAwaser://give right question
- {
- if (quizShow.Open)
- {
- if (client.Quiz == null)
- client.Quiz = quizShow.RegisteredUsers[client.Entity.UID];
- if (client.Quiz == null) break;
- client.Quiz.Timer += (ushort)quizShow.NewQuestionTime;
- byte answer = packet[8];
- if (answer > 4) break;
- bool right = answer == quizShow.CurrentQuestion.AnswerRight;
- client.Quiz.Answered = true;
- ulong pts = 300;
- if (right)
- {
- pts = (byte)(quizShow.RightAnswerReward + quizShow.TimeLimit - quizShow.NewQuestionTime);
- client.Quiz.RightQuestion = 1;
- client.Quiz.Points += pts;
- client.Entity.QuizPoints += pts;
- client.Entity.TreasuerPoints += 1;
- }
- else
- {
- pts = 300;
- client.Quiz.RightQuestion = 2;
- client.Quiz.Points += pts;
- client.Entity.QuizPoints += pts;
- }
- client.IncreaseExperience(client.ExpBall / 300 * pts, false);
- if (quizShow.FirstQuestion)
- {
- QuizRank rnk = new QuizRank();
- rnk.GiveRight = client.Quiz.RightQuestion;
- rnk.MyPoints = (ushort)client.Quiz.Points;
- rnk.MyRank = 0;
- rnk.MyTime = client.Quiz.Timer;
- rnk.Type = QuizShowTypes.SendTop;
- client.Send(rnk.ToArray());
- }
- }
- break;
- }
- case Remove:
- {
- if (quizShow.Open)
- quizShow.RemovePlayer(client);
- break;
- }
- }
- break;
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement