コード例 #1
0
 public void method_2(GameClient Session, string string_0)
 {
     if (!this.method_0(string_0))
     {
         ServerMessage Message = new ServerMessage(213u);
         Message.AppendRawInt32(0);
         Session.SendMessage(Message);
     }
     else
     {
         DataRow dataRow = null;
         using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
         {
             @class.AddParamWithValue("code", string_0);
             dataRow = @class.ReadDataRow("SELECT * FROM vouchers WHERE code = @code LIMIT 1");
         }
         int num = (int)dataRow["credits"];
         int num2 = (int)dataRow["pixels"];
         int num3 = (int)dataRow["vip_points"];
         this.method_1(string_0);
         if (num > 0)
         {
             Session.GetHabbo().Credits += num;
             Session.GetHabbo().method_13(true);
         }
         if (num2 > 0)
         {
             Session.GetHabbo().ActivityPoints += num2;
             Session.GetHabbo().method_15(true);
         }
         if (num3 > 0)
         {
             Session.GetHabbo().VipPoints += num3;
             Session.GetHabbo().method_14(false, true);
         }
         Session.SendMessage(new ServerMessage(212u));
     }
 }
コード例 #2
0
 private void method_33()
 {
     int num = 0;
     if (!this.bool_6 && !this.bool_7)
     {
         try
         {
             this.int_14++;
             if (this.bool_10 && this.int_14 >= 30)
             {
                 using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
                 {
                     @class.ExecuteQuery(string.Concat(new object[]
                     {
                         "UPDATE rooms SET users_now = '",
                         this.Int32_0,
                         "' WHERE Id = '",
                         this.uint_0,
                         "' LIMIT 1"
                     }));
                 }
                 this.int_14 = 0;
             }
             this.method_35();
             int num2 = 0;
             try
             {
                 if (this.hashtable_0 != null)
                 {
                     foreach (RoomItem class2 in this.Hashtable_0.Values)
                     {
                         if (class2.bool_1)
                         {
                             class2.method_2();
                         }
                     }
                 }
             }
             catch (Exception ex)
             {
                 Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task -- Process Floor Items");
                 this.method_34();
             }
             try
             {
                 if (this.hashtable_4 != null)
                 {
                     foreach (RoomItem class2 in this.Hashtable_1.Values)
                     {
                         if (class2.bool_1)
                         {
                             class2.method_2();
                         }
                     }
                 }
             }
             catch (Exception ex)
             {
                 Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task -- Process Wall Items");
                 this.method_34();
             }
             List<uint> list = new List<uint>();
             int num3 = 0;
             if (this.RoomUser_0 != null)
             {
                 try
                 {
                     for (int i = 0; i < this.RoomUser_0.Length; i++)
                     {
                         RoomUser class3 = this.RoomUser_0[i];
                         if (class3 != null)
                         {
                             num = 1;
                             if (!class3.IsBot && class3.GetClient() != null)
                             {
                                 num3++;
                                 if (class3.GetClient().GetHabbo() != null && class3.GetClient().GetHabbo().int_4 > 0)
                                 {
                                     class3.GetClient().GetHabbo().int_4--;
                                     if (class3.GetClient().GetHabbo().int_4 == 0)
                                     {
                                         class3.GetClient().GetHabbo().bool_3 = false;
                                     }
                                 }
                             }
                             if (this.musicController != null)
                             {
                                 this.musicController.Update(this);
                             }
                             class3.int_1++;
                             this.GetFreeze().CycleUser(class3);
                             num = 2;
                             if (!class3.bool_8 && class3.int_1 >= LicenseTools.int_14)
                             {
                                 class3.bool_8 = true;
                                 ServerMessage Message = new ServerMessage(486u);
                                 Message.AppendInt32(class3.VirtualId);
                                 Message.AppendBoolean(true);
                                 this.SendMessage(Message, null);
                             }
                             num = 3;
                             if (class3.GetClient() == null && !class3.IsBot)
                             {
                                 this.RoomUser_0[i] = null;
                                 if (!class3.bool_1)
                                 {
                                     this.byte_0[class3.int_3, class3.int_4] = class3.byte_0;
                                 }
                                 ServerMessage Message2 = new ServerMessage(29u);
                                 Message2.AppendRawInt32(class3.VirtualId);
                                 this.SendMessage(Message2, null);
                                 this.method_50();
                             }
                             num = 4;
                             if (class3.Boolean_2 && !list.Contains(class3.uint_0))
                             {
                                 list.Add(class3.uint_0);
                             }
                             num = 5;
                             if (class3.CarryItemID > 0)
                             {
                                 class3.int_6--;
                                 if (class3.int_6 <= 0)
                                 {
                                     class3.CarryItem(0);
                                 }
                             }
                             num = 6;
                             if (class3.bool_4 && class3.class34_1 == null)
                             {
                                 num = 7;
                                 if (class3.IsBot && class3.class34_0.RoomUser_0 != null && this.method_30(class3.int_12, class3.int_13, 0.0, true, true))
                                 {
                                     num = 8;
                                     this.method_85(class3);
                                     class3.int_3 = class3.int_12;
                                     class3.int_4 = class3.int_13;
                                     class3.double_0 = class3.double_1;
                                     class3.class34_0.RoomUser_0.int_3 = class3.int_12;
                                     class3.class34_0.RoomUser_0.int_4 = class3.int_13;
                                     class3.class34_0.RoomUser_0.double_0 = class3.double_1 + 1.0;
                                     class3.class34_0.RoomUser_0.bool_4 = false;
                                     class3.class34_0.RoomUser_0.method_12("mv");
                                     if (class3.int_3 == this.Class28_0.int_0 && class3.int_4 == this.Class28_0.int_1 && !list.Contains(class3.class34_0.RoomUser_0.uint_0))
                                     {
                                         list.Add(class3.class34_0.RoomUser_0.uint_0);
                                     }
                                     this.method_87(class3, true, true);
                                 }
                                 else
                                 {
                                     if (this.method_30(class3.int_12, class3.int_13, 0.0, true, class3.bool_1))
                                     {
                                         num = 8;
                                         this.method_85(class3);
                                         class3.int_3 = class3.int_12;
                                         class3.int_4 = class3.int_13;
                                         class3.double_0 = class3.double_1;
                                         if (class3.int_3 == this.Class28_0.int_0 && class3.int_4 == this.Class28_0.int_1 && !list.Contains(class3.uint_0) && !class3.IsBot)
                                         {
                                             list.Add(class3.uint_0);
                                         }
                                         this.method_87(class3, true, true);
                                     }
                                 }
                                 class3.bool_4 = false;
                             }
                             num = 9;
                             if (class3.bool_6 && !class3.bool_5 && class3.class34_1 == null)
                             {
                                 num = 10;
                                 SquarePoint @struct = DreamPathfinder.GetNextStep(class3.int_3, class3.int_4, class3.int_10, class3.int_11, this.byte_0, this.double_1, this.class28_0.double_1, this.double_2, this.class28_0.int_4, this.class28_0.int_5, class3.bool_1, this.bool_5, this.HeightOverride[class3.int_10, class3.int_11]);
                                 num = 11;
                                 if (@struct.X != class3.int_3 || @struct.Y != class3.int_4)
                                 {
                                     num = 12;
                                     int int32_ = @struct.X;
                                     int int32_2 = @struct.Y;
                                     class3.method_12("mv");
                                     double num4 = this.method_84(int32_, int32_2, this.method_93(int32_, int32_2));
                                     class3.Statusses.Remove("lay");
                                     class3.Statusses.Remove("sit");
                                     class3.AddStatus("mv", string.Concat(new object[]
                                     {
                                         int32_,
                                         ",",
                                         int32_2,
                                         ",",
                                         num4.ToString().Replace(',', '.')
                                     }));
                                     num = 13;
                                     if (class3.IsBot && class3.class34_0.RoomUser_0 != null)
                                     {
                                         class3.class34_0.RoomUser_0.AddStatus("mv", string.Concat(new object[]
                                         {
                                             int32_,
                                             ",",
                                             int32_2,
                                             ",",
                                             (num4 + 1.0).ToString().Replace(',', '.')
                                         }));
                                     }
                                     int num5;
                                     if (class3.bool_3)
                                     {
                                         num5 = Class107.smethod_1(class3.int_3, class3.int_4, int32_, int32_2);
                                     }
                                     else
                                     {
                                         num5 = Class107.smethod_0(class3.int_3, class3.int_4, int32_, int32_2);
                                     }
                                     class3.int_8 = num5;
                                     class3.int_7 = num5;
                                     class3.bool_4 = true;
                                     class3.int_12 = int32_;
                                     class3.int_13 = int32_2;
                                     class3.double_1 = num4;
                                     num = 14;
                                     if (class3.IsBot && class3.class34_0.RoomUser_0 != null)
                                     {
                                         class3.class34_0.RoomUser_0.int_8 = num5;
                                         class3.class34_0.RoomUser_0.int_7 = num5;
                                         class3.class34_0.RoomUser_0.bool_4 = true;
                                         class3.class34_0.RoomUser_0.int_12 = int32_;
                                         class3.class34_0.RoomUser_0.int_13 = int32_2;
                                         class3.class34_0.RoomUser_0.double_1 = num4 + 1.0;
                                     }
                                     try
                                     {
                                         num = 15;
                                         if (!class3.IsBot)
                                         {
                                             if (class3.GetClient().GetHabbo().Gender.ToLower() == "m" && this.byte_1[int32_, int32_2] > 0 && class3.byte_1 != this.byte_1[int32_, int32_2])
                                             {
                                                 class3.GetClient().GetHabbo().method_24().method_2((int)this.byte_1[int32_, int32_2], true);
                                                 class3.byte_1 = this.byte_1[int32_, int32_2];
                                             }
                                             else
                                             {
                                                 if (class3.GetClient().GetHabbo().Gender.ToLower() == "f" && this.byte_2[int32_, int32_2] > 0 && class3.byte_1 != this.byte_2[int32_, int32_2])
                                                 {
                                                     class3.GetClient().GetHabbo().method_24().method_2((int)this.byte_2[int32_, int32_2], true);
                                                     class3.byte_1 = this.byte_2[int32_, int32_2];
                                                 }
                                             }
                                         }
                                         else
                                         {
                                             if (!class3.isPet)
                                             {
                                                 if (this.byte_1[int32_, int32_2] > 0)
                                                 {
                                                     class3.class34_0.EffectId = (int)this.byte_1[int32_, int32_2];
                                                     class3.byte_1 = this.byte_1[int32_, int32_2];
                                                 }
                                                 ServerMessage Message3 = new ServerMessage(485u);
                                                 Message3.AppendInt32(class3.VirtualId);
                                                 Message3.AppendInt32(class3.class34_0.EffectId);
                                                 this.SendMessage(Message3, null);
                                             }
                                         }
                                         goto IL_CE1;
                                     }
                                     catch
                                     {
                                         goto IL_CE1;
                                     }
                                 IL_B8B:
                                     this.method_87(class3, false, true);
                                     class3.UpdateNeeded = true;
                                     if (class3.IsBot && class3.class34_0.RoomUser_0 != null)
                                     {
                                         this.method_87(class3.class34_0.RoomUser_0, true, true);
                                         class3.class34_0.RoomUser_0.UpdateNeeded = true;
                                         goto IL_BE0;
                                     }
                                     goto IL_BE0;
                                 IL_CE1:
                                     num = 16;
                                     this.byte_0[class3.int_3, class3.int_4] = class3.byte_0;
                                     class3.byte_0 = this.byte_0[class3.int_12, class3.int_13];
                                     if (this.AllowWalkthrough)
                                     {
                                         goto IL_B8B;
                                     }
                                     this.byte_0[int32_, int32_2] = 0;
                                     goto IL_B8B;
                                 }
                                 num = 12;
                                 class3.bool_6 = false;
                                 class3.method_12("mv");
                                 class3.bool_10 = false;
                                 if (class3.IsBot && class3.class34_0.RoomUser_0 != null)
                                 {
                                     class3.class34_0.RoomUser_0.method_12("mv");
                                     class3.class34_0.RoomUser_0.bool_6 = false;
                                     class3.class34_0.RoomUser_0.bool_10 = false;
                                     class3.class34_0.RoomUser_0.UpdateNeeded = true;
                                 }
                             IL_BE0:
                                 class3.UpdateNeeded = true;
                             }
                             else
                             {
                                 num = 17;
                                 if (class3.Statusses.ContainsKey("mv") && class3.class34_1 == null)
                                 {
                                     num = 18;
                                     class3.method_12("mv");
                                     class3.UpdateNeeded = true;
                                     if (class3.IsBot && class3.class34_0.RoomUser_0 != null)
                                     {
                                         class3.class34_0.RoomUser_0.method_12("mv");
                                         class3.class34_0.RoomUser_0.UpdateNeeded = true;
                                     }
                                 }
                             }
                             if (class3.IsBot || class3.isPet)
                             {
                                 try
                                 {
                                     class3.BotAI.OnTimerTick();
                                     goto IL_C9F;
                                 }
                                 catch
                                 {
                                     goto IL_C9F;
                                 }
                             }
                             goto IL_C9B;
                         IL_C9F:
                             if (class3.int_9 > 0)
                             {
                                 if (class3.int_9 == 1)
                                 {
                                     this.method_87(class3, true, true);
                                 }
                                 class3.int_9--;
                                 goto IL_CD6;
                             }
                             goto IL_CD6;
                         IL_C9B:
                             num2++;
                             goto IL_C9F;
                         }
                     IL_CD6: ;
                     }
                 }
                 catch (Exception ex)
                 {
                     Logging.LogThreadException(ex.ToString(), string.Concat(new object[]
                     {
                         "Room [ID: ",
                         this.Id,
                         "] [Part: ",
                         num,
                         " cycle task -- Process Users Updates"
                     }));
                     this.method_34();
                 }
             }
             try
             {
                 foreach (uint current in list)
                 {
                     this.method_47(GoldTree.GetGame().GetClientManager().method_2(current), true, false);
                 }
             }
             catch (Exception ex)
             {
                 Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task -- Remove Users");
                 this.method_34();
             }
             if (num2 >= 1)
             {
                 this.int_8 = 0;
             }
             else
             {
                 this.int_8++;
             }
             if (!this.bool_6 && !this.bool_7)
             {
                 try
                 {
                     if (this.int_8 >= 60)
                     {
                         GoldTree.GetGame().GetRoomManager().method_16(this);
                         return;
                     }
                     ServerMessage Logging = this.method_67(false);
                     if (Logging != null)
                     {
                         this.SendMessage(Logging, null);
                     }
                 }
                 catch (Exception ex)
                 {
                     Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task -- Cycle End");
                     this.method_34();
                 }
             }
             this.class27_0.UsersNow = num3;
         }
         catch (Exception ex)
         {
             Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task");
         }
     }
 }
コード例 #3
0
 public void method_6(int int_17, bool bool_13)
 {
     RoomUser @class = this.method_52(int_17);
     if (@class != null && @class.IsBot)
     {
         @class.BotAI.OnSelfLeaveRoom(bool_13);
         ServerMessage Message = new ServerMessage(29u);
         Message.AppendRawInt32(@class.VirtualId);
         this.SendMessage(Message, null);
         uint num = @class.uint_0;
         for (int i = 0; i < this.RoomUser_0.Length; i++)
         {
             RoomUser class2 = this.RoomUser_0[i];
             if (class2 != null && class2.uint_0 == num)
             {
                 this.RoomUser_0[i] = null;
             }
         }
     }
 }
コード例 #4
0
 public void method_47(GameClient Session, bool bool_13, bool bool_14)
 {
     int num = 1;
     if (Session != null && Session.GetHabbo() != null)
     {
         RoomUser @class = this.GetRoomUserByHabbo(Session.GetHabbo().Id);
         if (@class != null)
         {
             this.GetRoomTeamManager().OnUserLeave(@class);
         }
     }
     if (!bool_14 || !Session.GetHabbo().isJuniori)
     {
         if (this.bool_12)
         {
             if (bool_13 && Session != null)
             {
                 if (bool_14)
                 {
                     ServerMessage Message = new ServerMessage(33u);
                     Message.AppendInt32(4008);
                     Session.SendMessage(Message);
                 }
                 ServerMessage Message5_ = new ServerMessage(18u);
                 Session.SendMessage(Message5_);
             }
         }
         else
         {
             try
             {
                 if (Session != null && Session.GetHabbo() != null)
                 {
                     num = 2;
                     RoomUser @class = this.GetRoomUserByHabbo(Session.GetHabbo().Id);
                     if (@class != null)
                     {
                         this.RoomUser_0[@class.int_20] = null;
                         @class.int_20 = -1;
                         this.byte_0[@class.int_3, @class.int_4] = @class.byte_0;
                     }
                     num = 3;
                     if (bool_13)
                     {
                         if (bool_14)
                         {
                             ServerMessage Message = new ServerMessage(33u);
                             Message.AppendInt32(4008);
                             Session.SendMessage(Message);
                         }
                         ServerMessage Message5_ = new ServerMessage(18u);
                         Session.SendMessage(Message5_);
                     }
                     num = 4;
                     if (@class != null && [email protected]_11)
                     {
                         if (@class.byte_1 > 0 && @class.GetClient() != null)
                         {
                             @class.GetClient().GetHabbo().method_24().int_0 = -1;
                         }
                         this.byte_0[@class.int_3, @class.int_4] = @class.byte_0;
                         if (!this.Boolean_3)
                         {
                             ServerMessage Message2 = new ServerMessage(700u);
                             Message2.AppendBoolean(false);
                             Session.SendMessage(Message2);
                         }
                         ServerMessage Message3 = new ServerMessage(29u);
                         Message3.AppendRawInt32(@class.VirtualId);
                         this.SendMessage(Message3, null);
                         if (this.method_74(Session.GetHabbo().Id))
                         {
                             this.method_78(Session.GetHabbo().Id);
                         }
                         num = 5;
                         if (Session.GetHabbo().Username.ToLower() == this.Owner.ToLower() && this.Boolean_0)
                         {
                             this.Event = null;
                             ServerMessage Logging = new ServerMessage(370u);
                             Logging.AppendStringWithBreak("-1");
                             this.SendMessage(Logging, null);
                         }
                         num = 6;
                         if (@class.class34_1 != null)
                         {
                             @class.class34_1.RoomUser_0 = null;
                             @class.class34_1 = null;
                             Session.GetHabbo().method_24().int_0 = -1;
                         }
                         Session.GetHabbo().method_11();
                         this.bool_10 = true;
                         this.method_51();
                         List<RoomUser> list = new List<RoomUser>();
                         for (int i = 0; i < this.RoomUser_0.Length; i++)
                         {
                             RoomUser class2 = this.RoomUser_0[i];
                             if (class2 != null && class2.IsBot)
                             {
                                 list.Add(class2);
                             }
                         }
                         num = 7;
                         foreach (RoomUser current in list)
                         {
                             current.BotAI.OnUserLeaveRoom(Session);
                         }
                     }
                 }
             }
             catch (Exception ex)
             {
                 Logging.LogCriticalException(string.Concat(new object[]
                 {
                     "Error during removing user from room [Part: ",
                     num,
                     "]: ",
                     ex.ToString()
                 }));
             }
         }
     }
 }