public override void ProcessRawData() { try { Log.Trace("Begin Process Data"); //Lưu lại Data Log.Trace(StringData); string pTestDate; string pMonth = new string[] {}.ToString(); //Kiểm tra nếu chưa kết thúc nhận dữ liệu if (!StringData.EndsWith(DeviceHelper.ETX.ToString(CultureInfo.InvariantCulture))) { return; } string[] strResult = StringData.Split(DeviceHelper.CR); TestResult.TestDate = strResult[0].Substring(1, 9).Trim(); pMonth = strResult[0].Substring(4, 3); pTestDate = GetMonth(pMonth); TestResult.TestDate = string.Format("{0}/{1}/{2}{3}", TestResult.TestDate.Substring(0, 2), pTestDate, DateTime.Now.Year.ToString(CultureInfo.InvariantCulture).Substring(0, 2), TestResult.TestDate.Substring(7, 2)); TestResult.Barcode = strResult[1].Trim(); if (TestResult.Barcode.Equals("")) { TestResult.Barcode = "0"; } AddResult(new ResultItem("WBC", strResult[2].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("RBC", strResult[10].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("HGB", strResult[11].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("HCT", strResult[12].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("MCV", strResult[13].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("MCH", strResult[14].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("MCHC", strResult[15].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("PLT", strResult[17].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("%LY", strResult[3].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("%MO", strResult[4].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("%GR", strResult[5].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("#LY", strResult[6].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("#MO", strResult[7].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("#GR", strResult[8].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("#EO", strResult[9].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("RDW", strResult[16].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("PCT", strResult[18].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("MPV", strResult[19].Replace("L", "").Replace("H", "").Trim())); AddResult(new ResultItem("PDW", strResult[20].Replace("L", "").Replace("H", "").Trim())); Log.Debug("Import Result for barcode:" + TestResult.Barcode); ImportResults(); Log.Debug("Import Result Success"); } catch (Exception ex) { Log.Error(string.Format("{0} /n {1}", "Lỗi Trong quá trình xử lý dữ liệu", ex)); } finally { ClearData(); } }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null || string.IsNullOrWhiteSpace(StringData)) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } var Message = StringData.Split('-'); RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(User.GetClient(), "ACH_" + Message[0], int.Parse(Message[1])); return(true); }
public override void ProcessRawData() { try { string pTestDate, pday; string pMonth = new string[] {}.ToString(); //Kiểm tra nếu chưa kết thúc nhận dữ liệu if (!StringData.EndsWith(DeviceHelper.ETX.ToString(CultureInfo.InvariantCulture))) { return; } Log.Trace("Begin Process Data"); Log.Trace(DeviceHelper.CRLF + StringData); string[] strResult = StringData.Split(DeviceHelper.CR); TestResult.TestDate = strResult[0].Substring(1, 9).Trim(); pMonth = strResult[0].Substring(4, 3); //pTestDate = GetMonth(pMonth); pTestDate = DeviceHelper.GetMonth(pMonth); TestResult.TestDate = string.Format("{0}/{1}/20{2}", TestResult.TestDate.Substring(0, 2), pTestDate, TestResult.TestDate.Substring(7, 2)); TestResult.Barcode = strResult[1].Trim(); if (TestResult.Barcode.Equals("")) { TestResult.Barcode = "0"; } AddResult(new ResultItem("WBC", strResult[2].Replace("L", "").Replace("H", "").Trim(), "10^9/L")); AddResult(new ResultItem("RBC", strResult[10].Replace("L", "").Replace("H", "").Trim(), "10^12/L")); AddResult(new ResultItem("HGB", strResult[11].Replace("L", "").Replace("H", "").Trim(), "g/L")); AddResult(new ResultItem("HCT", strResult[12].Replace("L", "").Replace("H", "").Trim(), "%")); AddResult(new ResultItem("MCV", strResult[13].Replace("L", "").Replace("H", "").Trim(), "fL")); AddResult(new ResultItem("MCH", strResult[14].Replace("L", "").Replace("H", "").Trim(), "Pg")); AddResult(new ResultItem("MCHC", strResult[15].Replace("L", "").Replace("H", "").Trim(), "g/L")); AddResult(new ResultItem("PLT", strResult[17].Replace("L", "").Replace("H", "").Trim(), "10^3/uL")); AddResult(new ResultItem("%LY", strResult[3].Replace("L", "").Replace("H", "").Trim(), "%")); AddResult(new ResultItem("%MO", strResult[4].Replace("L", "").Replace("H", "").Trim(), "%")); AddResult(new ResultItem("%GR", strResult[5].Replace("L", "").Replace("H", "").Trim(), "%")); AddResult(new ResultItem("#LY", strResult[6].Replace("L", "").Replace("H", "").Trim(), "10^9/L")); AddResult(new ResultItem("#MO", strResult[7].Replace("L", "").Replace("H", "").Trim(), "10^9/L")); AddResult(new ResultItem("#GR", strResult[8].Replace("L", "").Replace("H", "").Trim(), "10^9/L")); AddResult(new ResultItem("#EO", strResult[9].Replace("L", "").Replace("H", "").Trim(), "10^9/L")); AddResult(new ResultItem("RDW", strResult[16].Replace("L", "").Replace("H", "").Trim(), "%CV")); AddResult(new ResultItem("PCT", strResult[18].Replace("L", "").Replace("H", "").Trim(), "%")); AddResult(new ResultItem("MPV", strResult[19].Replace("L", "").Replace("H", "").Trim(), "fL")); AddResult(new ResultItem("PDW", strResult[20].Replace("L", "").Replace("H", "").Trim(), "%")); ImportResults(); Log.Debug("Import Result Success For barocde:{0}", TestResult.Barcode); } catch (Exception ex) { //File.AppendAllText(@"C:\NIHONKODEN-ERROR.txt", ex.ToString()); } finally { ClearData(); } }
public override void ProcessRawData() { try { Log.Trace("Begin Process Data"); //Lưu lại Data Log.Trace("RawData:\n{0}", StringData); //Kiểm tra nếu là kí tự STX thì nhận dữ liệu if ( !(StringData.StartsWith(DeviceHelper.STX.ToString()) && StringData.EndsWith(DeviceHelper.ETX.ToString()))) { Log.Trace("Dữ liệu không hợp lệ"); return; } string[] rawData = StringData.Split(DeviceHelper.CR); //Lấy ngày: TestResult.TestDate = string.Format("{0}/{1}/{2}", rawData[17], rawData[16], rawData[15]); //Lấy barcode: TestResult.Barcode = rawData[22].Trim(); //Add Kết quả: AddResult(new ResultItem("WBC", rawData[23].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("NE%", rawData[24].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("LY%", rawData[25].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("MO%", rawData[26].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("EO%", rawData[27].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("BA%", rawData[28].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("NE", rawData[29].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("LY", rawData[30].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("MO", rawData[31].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("EO", rawData[32].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("BA", rawData[33].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("RBC", rawData[34].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("HGB", rawData[35].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("HCT", rawData[36].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("MCV", rawData[37].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("MCH", rawData[38].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("MCHC", rawData[39].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("RDW", rawData[40].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("PLT", rawData[41].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); AddResult(new ResultItem("MPV", rawData[43].Replace("*", "").Replace("H", "").Replace("L", "").Trim())); Log.Trace("Begin Import Result"); Log.Trace(ImportResults() ? "Import Result Success" : "Error while import result"); } catch (Exception ex) { Log.Error(string.Format("Error while process data {0}", ex)); } finally { ClearData(); } }
public override void ProcessRawData() { try { _timer.Elapsed -= TimerOnElapsed; } catch (Exception) { } finally { _timer.Elapsed += TimerOnElapsed; } try { //Kiểm tra nếu chưa kết thúc nhận dữ liệu if (!StringData.Contains(DeviceHelper.EOT.ToString(CultureInfo.InvariantCulture))) { _timer.Enabled = true; _timer.Start(); return; } _timer.Stop(); string[] allResult = StringData.Split(DeviceHelper.CR); foreach (string record in allResult) { TestResult.TestDate = DateTime.Now.ToString("dd/MM/yyyy"); bool startsWithD = record.StartsWith(string.Format("{0}D", DeviceHelper.STX)); bool startsWithRcs = record.StartsWith(string.Format("{0}RCS", DeviceHelper.STX)); if (startsWithD || startsWithRcs) { string[] strResult = DeviceHelper.DeleteAllBlankLine(record, " "); try { TestResult.Barcode = strResult[0].Substring(startsWithD ? 2 : 7); } catch (Exception) { TestResult.Barcode = ""; } try { TestResult.Add(new ResultItem(strResult[1], strResult[2], strResult[3])); } catch (Exception) { } ImportResults(); } } ClearData(); } catch (Exception ex) { throw ex; } }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null || string.IsNullOrWhiteSpace(StringData)) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } string[] Message = StringData.Split('_'); if (Message[0] == "1") { Player.GetClient().SendMessage(new RoomNotificationComposer(Message[1], Message[2], "gifts_event", Message[3], "event:" + Message[4])); } if (Message[0] == "2") { Player.GetClient().SendMessage(new RoomCustomizedAlertComposer(Message[1])); } if (Message[0] == "3") { Player.GetClient().SendMessage(new MassEventComposer(Message[1])); } if (Message[0] == "4") { Player.GetClient().SendMessage(RoomNotificationComposer.SendBubble(Message[1], Message[2], Message[3])); } if (Message[0] == "5") { Player.GetClient().SendMessage(new WiredSmartAlertComposer(Message[1])); } //if (Message[0] == "6") //{ // string eventillo = "<img src=\"icon_256.png\" alt=\"xD\" height=\"15\" width=\"15\"></img>"; // Player.GetClient().SendMessage(new UserNameChangeComposer(Instance.Id, User.VirtualId, eventillo)); // Player.GetClient().SendChat("Hay un nuevo evento, haz <a href='event:navigator/goto/3'><b>click aquí</b></a> para ir al evento. ", 33); //} return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null) { return(false); } RoomUser Actor = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (Actor == null) { return(false); } RoomUser User = Instance.GetRoomUserManager().GetBotByName(StringData.Split(';')[0]); if (User == null) { return(false); } if (User.BotData.TargetUser == 0) { if (!Instance.GetGameMap().CanWalk(Actor.SquareBehind.X, Actor.SquareBehind.Y, false)) { return(false); } string[] Data = StringData.Split(';'); int DrinkId; if (!int.TryParse(Data[1], out DrinkId)) { return(false); } User.CarryItem(DrinkId); User.BotData.TargetUser = Actor.HabboId; User.MoveTo(Actor.SquareBehind.X, Actor.SquareBehind.Y); } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (string.IsNullOrEmpty(StringData)) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null) { return(false); } RoomUser Actor = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (Actor == null) { return(false); } RoomUser User = Instance.GetRoomUserManager().GetBotByName(StringData.Split(';')[0]); if (User == null) { return(false); } if (User.BotData.TargetUser == 0) { if (!Instance.GetGameMap().CanWalk(Actor.SquareBehind.X, Actor.SquareBehind.Y, false)) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "No puedo alcanzarte ¡debes acercarte más a mi!", 0, 31)); } else { string[] Data = StringData.Split(';'); int DrinkId = int.Parse(Data[1]); User.CarryItem(DrinkId); User.BotData.TargetUser = Actor.HabboId; Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "Aquí tienes tu bebida " + Player.GetClient().GetHabbo().Username + "!", 0, 31)); User.MoveTo(Actor.SquareBehind.X, Actor.SquareBehind.Y); } } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (string.IsNullOrEmpty(StringData)) { return(false); } var player = (Habbo)Params[0]; if (player == null) { return(false); } var actor = Instance.GetRoomUserManager().GetRoomUserByHabbo(player.Id); if (actor == null) { return(false); } var user = Instance.GetRoomUserManager().GetBotByName(StringData.Split(';')[0]); if (user == null) { return(false); } if (user.BotData.TargetUser == 0) { if (!Instance.GetGameMap().CanWalk(actor.SquareBehind.X, actor.SquareBehind.Y, false)) { return(false); } var data = StringData.Split(';'); int drinkId; if (!int.TryParse(data[1], out drinkId)) { return(false); } user.CarryItem(drinkId); user.BotData.TargetUser = actor.HabboId; user.MoveTo(actor.SquareBehind.X, actor.SquareBehind.Y); } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (string.IsNullOrEmpty(StringData)) { return(false); } var Stuff = StringData.Split('\t'); if (Stuff.Length != 2) { return(false);//This is important, incase a c**t scripts. } var Username = Stuff[0]; var User = Instance.GetRoomUserManager().GetBotByName(Username); if (User == null) { return(false); } var Figure = Stuff[1]; var UserChangeComposer = new ServerPacket(ServerPacketHeader.UserChangeMessageComposer); UserChangeComposer.WriteInteger(User.VirtualId); UserChangeComposer.WriteString(Figure); UserChangeComposer.WriteString("M"); UserChangeComposer.WriteString(User.BotData.Motto); UserChangeComposer.WriteInteger(0); Instance.SendPacket(UserChangeComposer); User.BotData.Look = Figure; User.BotData.Gender = "M"; using (var dbClient = Program.DatabaseManager.GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `look` = @look, `gender` = @gender WHERE `id` = '" + User.BotData.Id + "' LIMIT 1"); dbClient.AddParameter("look", User.BotData.Look); dbClient.AddParameter("gender", User.BotData.Gender); dbClient.RunQuery(); } return(true); }
public bool Execute(params object[] Params) { if (Params.Length != 1) { return(false); } var player = (Habbo)Params[0]; if (player == null) { return(false); } var user = Instance.GetRoomUserManager().GetRoomUserByHabbo(player.Id); if (user == null) { return(false); } if (player.GetPermissions().HasRight("mod_tool") || Instance.OwnerId == player.Id) { player.GetClient() .SendPacket(new WhisperComposer(user.VirtualId, "Wired Mute Exception: Unmutable Player", 0, 0)); return(false); } var time = StringData != null?int.Parse(StringData.Split(';')[0]) : 0; var message = StringData != null?StringData.Split(';')[1] : "No message!"; if (time > 0) { player.GetClient().SendPacket(new WhisperComposer(user.VirtualId, "Wired Mute: Muted for " + time + "! Message: " + message, 0, 0)); if (!Instance.MutedUsers.ContainsKey(player.Id)) { Instance.MutedUsers.Add(player.Id, PlusEnvironment.GetUnixTimestamp() + time * 60); } else { Instance.MutedUsers.Remove(player.Id); Instance.MutedUsers.Add(player.Id, PlusEnvironment.GetUnixTimestamp() + time * 60); } } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } string[] Stuff = StringData.Split('\t'); if (Stuff.Length != 2) { return(false);//This is important, incase a c**t scripts. } string Username = Stuff[0]; RoomUser User = Instance.GetRoomUserManager().GetBotByName(Username); if (User == null) { return(false); } string Figure = Stuff[1]; User.BotData.Look = Figure; User.BotData.Gender = "M"; MessageComposer UserChangeComposer = new UserChangeComposer(User.VirtualId, User.BotData); Instance.SendPacket(UserChangeComposer); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `look` = @look, `gender` = @gender WHERE `id` = '" + User.BotData.Id + "' LIMIT 1"); dbClient.AddParameter("look", User.BotData.Look); dbClient.AddParameter("gender", User.BotData.Gender); dbClient.RunQuery(); } return(true); }
private void TeleportUser(Habbo Player) { RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (User == null) { return; } Room Instance = Player.CurrentRoom; int RewardPoints = int.Parse(StringData.Split(';')[0]) * int.Parse(StringData.Split(';')[1]); User.GetClient().GetHabbo().GetStats().AchievementPoints += RewardPoints; User.GetClient().SendMessage(new AchievementScoreComposer(User.GetClient().GetHabbo().GetStats().AchievementPoints)); User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("RewardPoints", "Felicidades, acabas de ganar " + RewardPoints + " puntos de recompensa.", "")); }
public bool Execute(params object[] Params) { if (Params.Length != 1) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null) { return(false); } RoomUser User = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (User == null) { return(false); } if (Player.GetPermissions().HasRight("mod_tool") || this.Instance.OwnerId == Player.Id) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "Wired Mute Exception: Unmutable Player", 0, 0)); return(false); } int Time = (StringData != null ? int.Parse(StringData.Split(';')[0]) : 0); string Message = (StringData != null ? (StringData.Split(';')[1]) : "No message!"); if (Time > 0) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "Wired Mute: Muted for " + Time + "! Message: " + Message, 0, 0)); if (!Instance.MutedUsers.ContainsKey(Player.Id)) { Instance.MutedUsers.Add(Player.Id, (QuasarEnvironment.GetUnixTimestamp() + (Time * 60))); } else { Instance.MutedUsers.Remove(Player.Id); Instance.MutedUsers.Add(Player.Id, (QuasarEnvironment.GetUnixTimestamp() + (Time * 60))); } } return(true); }
public bool Execute(params object[] Params) { if (Params.Length == 0) { return(false); } if (string.IsNullOrEmpty(StringData)) { return(false); } var countOne = StringData != null?int.Parse(StringData.Split(';')[0]) : 1; var countTwo = StringData != null?int.Parse(StringData.Split(';')[1]) : 50; if (Instance.UserCount >= countOne && Instance.UserCount <= countTwo) { return(false); } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (String.IsNullOrEmpty(this.StringData)) { return(false); } this.StringData.Split(' '); string BotName = this.StringData.Split(' ')[0]; string Chat = this.StringData.Split(' ')[1]; string Message = StringData.Split(' ')[1]; string MessageFiltered = StringData.Split(' ')[1]; RoomUser User = this.Instance.GetRoomUserManager().GetBotByName(BotName); if (User == null) { return(false); } Habbo Player = (Habbo)Params[0]; if (this.BoolData) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Chat, 0, 31)); } else { User.Chat(Player.GetClient().GetHabbo().Username + ": " + Chat, false, User.LastBubble); } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (string.IsNullOrEmpty(StringData)) { return(false); } StringData.Split(' '); string BotName = StringData.Split(' ')[0]; string Chat = StringData.Split(' ')[1]; RoomUser User = Instance.GetRoomUserManager().GetBotByName(BotName); if (User == null) { return(false); } if (BoolData == true) { User.Shout(Chat, true, 31); } else { User.Chat(Chat, false, 31); } return(true); }
private void TeleportUser(Habbo Player) { RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (User == null) { return; } Room Instance = Player.CurrentRoom; int currentscore = 0; int mScore = int.Parse(StringData.Split(';')[0]) * int.Parse(StringData.Split(';')[1]); KeyValuePair <int, string> newkey; KeyValuePair <int, string> item; if ((Instance == null || User == null ? false : !User.IsBot)) { Instance.GetRoomItemHandler().usedwiredscorebord = true; if (Instance.WiredScoreFirstBordInformation.Count == 3) { Instance.GetRoomItemHandler().ScorebordChangeCheck(); } if ((Instance.WiredScoreBordDay == null || Instance.WiredScoreBordMonth == null ? false : Instance.WiredScoreBordWeek != null)) { string username = User.GetClient().GetHabbo().Username; lock (Instance.WiredScoreBordDay) { if (!Instance.WiredScoreBordDay.ContainsKey(User.UserId)) { Instance.WiredScoreBordDay.Add(User.UserId, new KeyValuePair <int, string>(mScore, username)); } else { item = Instance.WiredScoreBordDay[User.UserId]; currentscore = (item.Key + mScore); newkey = new KeyValuePair <int, string>(currentscore, username); Instance.WiredScoreBordDay[User.UserId] = newkey; } } lock (Instance.WiredScoreBordWeek) { if (!Instance.WiredScoreBordWeek.ContainsKey(User.UserId)) { Instance.WiredScoreBordWeek.Add(User.UserId, new KeyValuePair <int, string>(mScore, username)); } else { item = Instance.WiredScoreBordWeek[User.UserId]; currentscore = (item.Key + mScore); newkey = new KeyValuePair <int, string>(currentscore, username); Instance.WiredScoreBordWeek[User.UserId] = newkey; } } lock (Instance.WiredScoreBordMonth) { if (!Instance.WiredScoreBordMonth.ContainsKey(User.UserId)) { Instance.WiredScoreBordMonth.Add(User.UserId, new KeyValuePair <int, string>(mScore, username)); } else { item = Instance.WiredScoreBordMonth[User.UserId]; currentscore = (item.Key + mScore); newkey = new KeyValuePair <int, string>(currentscore, username); Instance.WiredScoreBordMonth[User.UserId] = newkey; } } //Instance.GetWired().ExecuteWired(WiredItemType.TriggerScoreAchieved, User, currentscore); } Instance.GetRoomItemHandler().UpdateWiredScoreBord(); User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("award", "Has ganado " + mScore + " puntos en la clasificación. ¡Enhorabuena!", "")); if (Player.Effects() != null) { Player.Effects().ApplyEffect(0); } } }
public bool Execute(params object[] Params) { if (Params.Length == 0) { return(false); } if (string.IsNullOrEmpty(StringData) || StringData == "0;0;0" || SetItems.Count == 0) { return(false); } foreach (var item in SetItems.Values.ToList()) { if (!Instance.GetRoomItemHandler().GetFloor.Contains(item)) { continue; } foreach (var I in ItemsData.Split(';')) { if (string.IsNullOrEmpty(I)) { continue; } var ii = Instance.GetRoomItemHandler().GetItem(Convert.ToInt32(I.Split(':')[0])); if (ii == null) { continue; } var partsString = I.Split(':'); var part = partsString[1].Split(','); if (int.Parse(StringData.Split(';')[0]) == 1) //State { if (ii.ExtraData == part[4]) { return(false); } } if (int.Parse(StringData.Split(';')[1]) == 1) //Direction { if (ii.Rotation == Convert.ToInt32(part[3])) { return(false); } } if (int.Parse(StringData.Split(';')[2]) == 1) //Position { if (ii.GetX == Convert.ToInt32(part[0]) && ii.GetY == Convert.ToInt32(part[1]) && ii.GetZ == Convert.ToDouble(part[2])) { return(false); } } } } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (string.IsNullOrEmpty(StringData)) { return(false); } var player = (Habbo)Params[0]; if (player == null) { return(false); } var human = Instance.GetRoomUserManager().GetRoomUserByHabbo(player.Id); if (human == null) { return(false); } var stuff = StringData.Split(';'); if (stuff.Length != 2) { return(false); //This is important, incase a c**t scripts. } var username = stuff[1]; var user = Instance.GetRoomUserManager().GetBotByName(username); if (user == null) { return(false); } var followMode = 0; if (!int.TryParse(stuff[0], out followMode)) { return(false); } if (followMode == 0) { user.BotData.ForcedUserTargetMovement = 0; if (user.IsWalking) { user.ClearMovement(true); } } else if (followMode == 1) { user.BotData.ForcedUserTargetMovement = player.Id; if (user.IsWalking) { user.ClearMovement(true); } user.MoveTo(human.X, human.Y); } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (string.IsNullOrEmpty(StringData)) { return(false); } string[] Stuff = StringData.Split('\t'); if (Stuff.Length != 2) { return(false);//This is important, incase a c**t scripts. } Habbo Player = (Habbo)Params[0]; if (Player == null) { return(false); } RoomUser User = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (User == null) { return(false); } //string Username = Stuff[0]; //RoomUser User = this.Instance.GetRoomUserManager().GetBotByName(Username); //if (User == null) // return false; string Figure = Stuff[1]; User.GetClient().GetHabbo().Look = Figure; ServerPacket UserChangeComposer = new ServerPacket(ServerPacketHeader.UserChangeMessageComposer); UserChangeComposer.WriteInteger(User.VirtualId); UserChangeComposer.WriteString(Figure); UserChangeComposer.WriteString("M"); UserChangeComposer.WriteString(User.GetClient().GetHabbo().Motto); UserChangeComposer.WriteInteger(0); Instance.SendMessage(UserChangeComposer); User.GetClient().SendWhisper("Hola", 1); User.GetClient().SendMessage(new AvatarAspectUpdateMessageComposer(User.GetClient().GetHabbo().Look, User.GetClient().GetHabbo().Gender)); //User.BotData.Look = Figure; //User.BotData.Gender = "M"; //using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) //{ // dbClient.SetQuery("UPDATE `bots` SET `look` = @look, `gender` = '" + User.BotData.Gender + "' WHERE `id` = '" + User.BotData.Id + "' LIMIT 1"); // dbClient.AddParameter("look", User.BotData.Look); // dbClient.RunQuery(); //} return(true); }
public bool OnCycle() { if (!Requested || String.IsNullOrEmpty(StringData) || StringData == "0;0;0" || SetItems.Count == 0) { return(false); } foreach (Item item in SetItems.Values.ToList()) { if (Instance.GetRoomItemHandler().GetFloor == null && !Instance.GetRoomItemHandler().GetFloor.Contains(item)) { continue; } foreach (string I in ItemsData.Split(';')) { if (string.IsNullOrEmpty(I)) { continue; } int itemId = Convert.ToInt32(I.Split(':')[0]); Item II = Instance.GetRoomItemHandler().GetItem(Convert.ToInt32(itemId)); if (II == null) { continue; } string[] partsString = I.Split(':'); try { if (string.IsNullOrEmpty(partsString[0]) || string.IsNullOrEmpty(partsString[1])) { continue; } } catch { continue; } string[] part = partsString[1].Split(','); try { if (int.Parse(StringData.Split(';')[0]) == 1)//State { if (part.Count() >= 4) { SetState(II, part[4].ToString()); } else { SetState(II, "1"); } } } catch (Exception e) { ExceptionLogger.LogWiredException(e); } try { if (int.Parse(StringData.Split(';')[1]) == 1)//Direction { SetRotation(II, Convert.ToInt32(part[3])); } } catch (Exception e) { ExceptionLogger.LogWiredException(e); } try { if (int.Parse(StringData.Split(';')[2]) == 1)//Position { SetPosition(II, Convert.ToInt32(part[0].ToString()), Convert.ToInt32(part[1].ToString()), Convert.ToDouble(part[2].ToString())); } } catch (Exception e) { ExceptionLogger.LogWiredException(e); } } } Requested = false; return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Owner = CloudServer.GetHabboById(Item.UserID); if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards")) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } int amountLeft = int.Parse(StringData.Split('-')[2]); int often = int.Parse(StringData.Split('-')[1]); bool unique = BoolData; bool premied = false; if (amountLeft == 1) { Player.GetClient().SendNotification("Ya no hay mas premios, vuelve mas tarde."); return(true); } foreach (var dataStr in (StringData.Split('-')[0]).Split(';')) { var dataArray = dataStr.Split(','); var isbadge = dataArray[0] == "0"; var code = dataArray[1]; var percentage = int.Parse(dataArray[2]); var random = CloudServer.GetRandomNumber(0, 100); if (!unique && percentage < random) { continue; } premied = true; if (isbadge) { if (Player.GetBadgeComponent().HasBadge(code)) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "Oops,Parece que já recebeu este emblema !", 0, User.LastBubble)); } else { Player.GetBadgeComponent().GiveBadge(code, true, Player.GetClient()); Player.GetClient().SendMessage(RoomNotificationComposer.SendBubble("badge/" + Params[2], "Acaba de receber um emblema!", "/inventory/open/badge")); } } else { ItemData ItemData = null; if (!CloudServer.GetGame().GetItemManager().GetItem(int.Parse(code), out ItemData)) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "No se pudo obtener Item ID: " + code, 0, User.LastBubble)); return(false); } Item Item = ItemFactory.CreateSingleItemNullable(ItemData, Player.GetClient().GetHabbo(), "", "", 0, 0, 0); if (Item != null) { Player.GetClient().GetHabbo().GetInventoryComponent().TryAddItem(Item); Player.GetClient().SendMessage(new FurniListNotificationComposer(Item.Id, 1)); Player.GetClient().SendMessage(new PurchaseOKComposer()); Player.GetClient().SendMessage(new FurniListAddComposer(Item)); Player.GetClient().SendMessage(new FurniListUpdateComposer()); Player.GetClient().SendNotification("¡Has recibido un regalo! Revisa tu inventario."); } } } if (!premied) { Player.GetClient().SendNotification("Suerte la proxima vez :("); } else if (amountLeft > 1) { amountLeft--; this.StringData.Split('-')[2] = amountLeft.ToString(); } return(true); }
public bool Execute(params object[] Params) { if (Params.Length == 0) { return(false); } if (string.IsNullOrEmpty(StringData) || StringData == "0;0;0" || SetItems.Count == 0) { return(false); } foreach (Item Item in SetItems.Values.ToList()) { if (Item == null) { continue; } if (!Instance.GetRoomItemHandler().GetFloor.Contains(Item)) { continue; } foreach (string I in ItemsData.Split(';')) { if (string.IsNullOrEmpty(I)) { continue; } Item II = Instance.GetRoomItemHandler().GetItem(Convert.ToInt32(I.Split(':')[0])); if (II == null) { continue; } string[] partsString = I.Split(':'); string[] part = partsString[1].Split(','); if (int.Parse(StringData.Split(';')[0]) == 1) //State { try { if (II.ExtraData != part[4].ToString()) { return(false); } } catch { } } if (int.Parse(StringData.Split(';')[1]) == 1) //Direction { try { if (II.Rotation != Convert.ToInt32(part[3])) { return(false); } } catch { } } if (int.Parse(StringData.Split(';')[2]) == 1) //Position { try { if (II.GetX != Convert.ToInt32(part[0]) || II.GetY != Convert.ToInt32(part[1]) || II.GetZ != Convert.ToDouble(part[2])) { return(false); } } catch { } } } } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Owner = NeonEnvironment.GetHabboById(Item.UserID); if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards")) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } Room Room = Player.CurrentRoom; if (string.IsNullOrEmpty(StringData)) { return(false); } int SplitNumber = -1; int oftenforuser = int.Parse(StringData.Split('-')[3]); int amountLeft = int.Parse(StringData.Split('-')[2]); int often = int.Parse(StringData.Split('-')[1]); string Reward = StringData.Split('-')[0]; bool unique = BoolData; int totalrewards = (StringData.Split('-')[0]).Split(';').Count(); bool premied = false; /* * Often numbers * 3- 1/min * 2- 1/Hour * 1- 1/Day * 0- Once * */ if (amountLeft == 1) { Player.GetClient().SendMessage(new WiredRewardAlertComposer(0)); return(true); } if (!unique) { int percentage1 = 0; int percentage2 = 0; int percentage3 = 0; int percentage4 = 0; int percentage5 = 0; int totalpercentage = 0; if (totalrewards > 0) { percentage1 = int.Parse(((StringData.Split('-')[0]).Split(';')[0]).Split(',')[2]); } else if (totalrewards > 1) { percentage2 = int.Parse(((StringData.Split('-')[0]).Split(';')[1]).Split(',')[2]) + percentage1; } else if (totalrewards > 2) { percentage3 = int.Parse(((StringData.Split('-')[0]).Split(';')[2]).Split(',')[2]) + percentage2; } else if (totalrewards > 3) { percentage4 = int.Parse(((StringData.Split('-')[0]).Split(';')[3]).Split(',')[2]) + percentage3; } else if (totalrewards > 4) { percentage5 = int.Parse(((StringData.Split('-')[0]).Split(';')[4]).Split(',')[2]) + percentage4; } totalpercentage = percentage5 + percentage4 + percentage3 + percentage2 + percentage1; int random = NeonEnvironment.GetRandomNumber(0, 100); if (random > totalpercentage) { Player.GetClient().SendMessage(new WiredRewardAlertComposer(4)); return(true); } if (percentage1 >= random) { SplitNumber = 0; } else if (percentage1 <= random && random <= percentage2) { SplitNumber = 1; } else if (percentage2 <= random && random <= percentage3) { SplitNumber = 2; } else if (percentage3 <= random && random <= percentage4) { SplitNumber = 3; } else if (percentage4 <= random && random <= percentage5 || random >= percentage5) { SplitNumber = 4; } Player.GetClient().SendWhisper(random + " | " + SplitNumber + " | " + totalpercentage); string[] dataArray = ((StringData.Split('-')[0]).Split(';')[SplitNumber]).Split(','); bool isbadge = dataArray[0] == "0"; string code = dataArray[1]; int percentage = int.Parse(dataArray[2]); premied = true; if (isbadge) { if (code.StartsWith("diamonds:")) { foreach (string reward in code.Split('-')) { string[] dataArray2 = code.Split(':'); int diamonds = int.Parse(dataArray2[1]); if (diamonds > 100) { Player.GetClient().SendMessage(new RoomCustomizedAlertComposer("¡Ha ocurrido un error! Avisa a un miembro del equipo Staff.")); NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("advice", "" + Player.GetClient().GetHabbo().Username + " ha usado un wired que no sigue las normas del hotel.\n Click aquí.", "event:navigator/goto/" + Player.GetClient().GetHabbo().CurrentRoomId)); } else { Player.GetClient().GetHabbo().Diamonds += diamonds; Player.GetClient().SendMessage(new HabboActivityPointNotificationComposer(Player.GetClient().GetHabbo().Diamonds, diamonds, 5)); } } } else if (Player.GetBadgeComponent().HasBadge(code)) { Player.GetClient().SendMessage(new WiredRewardAlertComposer(5)); } else { Player.GetBadgeComponent().GiveBadge(code, true, Player.GetClient()); Player.GetClient().SendMessage(new WiredRewardAlertComposer(7)); } } else { if (!NeonEnvironment.GetGame().GetItemManager().GetItem(int.Parse(code), out ItemData ItemData)) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "No se pudo obtener Item ID: " + code, 0, User.LastBubble)); return(false); } Item Item = ItemFactory.CreateSingleItemNullable(ItemData, Player.GetClient().GetHabbo(), "", "", 0, 0, 0); if (Item != null) { Player.GetClient().GetHabbo().GetInventoryComponent().TryAddItem(Item); Player.GetClient().SendMessage(new FurniListNotificationComposer(Item.Id, 1)); Player.GetClient().SendMessage(new PurchaseOKComposer()); Player.GetClient().SendMessage(new FurniListAddComposer(Item)); Player.GetClient().SendMessage(new FurniListUpdateComposer()); Player.GetClient().SendMessage(new WiredRewardAlertComposer(6)); } } } else { foreach (string dataStr in (StringData.Split('-')[0]).Split(';')) { string[] dataArray = dataStr.Split(','); bool isbadge = dataArray[0] == "0"; string code = dataArray[1]; int percentage = int.Parse(dataArray[2]); int random = NeonEnvironment.GetRandomNumber(0, 100); premied = true; if (isbadge) { if (code.StartsWith("diamonds:")) { foreach (string reward in code.Split('-')) { string[] dataArray2 = code.Split(':'); int diamonds = int.Parse(dataArray2[1]); if (diamonds > 100) { Player.GetClient().SendMessage(new RoomCustomizedAlertComposer("¡Ha ocurrido un error! Avisa a un miembro del equipo Staff.")); NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("advice", "" + Player.GetClient().GetHabbo().Username + " ha usado un wired que no sigue las normas del hotel.\n Click aquí.", "event:navigator/goto/" + Player.GetClient().GetHabbo().CurrentRoomId)); } else { Player.GetClient().GetHabbo().Diamonds += diamonds; Player.GetClient().SendMessage(new HabboActivityPointNotificationComposer(Player.GetClient().GetHabbo().Diamonds, diamonds, 5)); } } } if (Player.GetBadgeComponent().HasBadge(code)) { Player.GetClient().SendMessage(new WiredRewardAlertComposer(5)); } else { Player.GetBadgeComponent().GiveBadge(code, true, Player.GetClient()); Player.GetClient().SendMessage(new WiredRewardAlertComposer(7)); } } else { if (!NeonEnvironment.GetGame().GetItemManager().GetItem(int.Parse(code), out ItemData ItemData)) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "No se pudo obtener Item ID: " + code, 0, User.LastBubble)); return(false); } Item Item = ItemFactory.CreateSingleItemNullable(ItemData, Player.GetClient().GetHabbo(), "", "", 0, 0, 0); if (Item != null) { Player.GetClient().GetHabbo().GetInventoryComponent().TryAddItem(Item); Player.GetClient().SendMessage(new FurniListNotificationComposer(Item.Id, 1)); Player.GetClient().SendMessage(new PurchaseOKComposer()); Player.GetClient().SendMessage(new FurniListAddComposer(Item)); Player.GetClient().SendMessage(new FurniListUpdateComposer()); Player.GetClient().SendMessage(new WiredRewardAlertComposer(6)); } } } } if (premied) { } else if (!premied) { Player.GetClient().SendMessage(new WiredRewardAlertComposer(4)); } else if (amountLeft > 1) { amountLeft--; StringData = Reward + "-" + often + "-" + amountLeft + "-" + oftenforuser; } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null) { return(false); } RoomUser Human = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (Human == null) { return(false); } string[] Stuff = StringData.Split(';'); if (Stuff.Length != 2) { return(false);//This is important, incase a c**t scripts. } string Username = Stuff[1]; RoomUser User = Instance.GetRoomUserManager().GetBotByName(Username); if (User == null) { return(false); } int FollowMode = 0; if (!int.TryParse(Stuff[0], out FollowMode)) { return(false); } if (FollowMode == 0) { User.BotData.ForcedUserTargetMovement = 0; if (User.IsWalking) { User.ClearMovement(true); } } else if (FollowMode == 1) { User.BotData.ForcedUserTargetMovement = Player.Id; if (User.IsWalking) { User.ClearMovement(true); } User.MoveTo(Human.X, Human.Y); } return(true); }
public bool OnCycle() { if (Instance == null || !Requested || _next == 0) { return(false); } long Now = PlusEnvironment.Now(); if (_next < Now) { foreach (Item Item in SetItems.Values.ToList()) { if (Item == null) { continue; } if (!Instance.GetRoomItemHandler().GetFloor.Contains(Item)) { continue; } Item toRemove = null; if (Instance.GetWired().OtherBoxHasItem(this, Item.Id)) { SetItems.TryRemove(Item.Id, out toRemove); } Point Point = HandleMovement(Convert.ToInt32(StringData.Split(';')[0]), new Point(Item.GetX, Item.GetY)); int newRot = HandleRotation(Convert.ToInt32(StringData.Split(';')[1]), Item.Rotation); Instance.GetWired().OnUserFurniCollision(Instance, Item); if (!Instance.GetGameMap().ItemCanMove(Item, Point)) { continue; } if (Instance.GetGameMap().CanRollItemHere(Point.X, Point.Y) && !Instance.GetGameMap().SquareHasUsers(Point.X, Point.Y)) { double NewZ = Instance.GetGameMap().GetHeightForSquareFromData(Point); bool CanBePlaced = true; List <Item> Items = Instance.GetGameMap().GetCoordinatedItems(Point); foreach (Item IItem in Items.ToList()) { if (IItem == null || IItem.Id == Item.Id) { continue; } if (!IItem.GetBaseItem().Walkable) { _next = 0; CanBePlaced = false; break; } if (IItem.TotalHeight > NewZ) { NewZ = IItem.TotalHeight; } if (CanBePlaced == true && !IItem.GetBaseItem().Stackable) { CanBePlaced = false; } } if (newRot != Item.Rotation) { Item.Rotation = newRot; Item.UpdateState(false, true); } if (CanBePlaced && Point != Item.Coordinate) { Instance.SendPacket(new SlideObjectBundleComposer(Item.GetX, Item.GetY, Item.GetZ, Point.X, Point.Y, NewZ, 0, 0, Item.Id)); Instance.GetRoomItemHandler().SetFloorItem(Item, Point.X, Point.Y, NewZ); } } } _next = 0; return(true); } return(false); }