public override void OnTimerTick() { if (this.SpeechTimer <= 0) { if (base.GetBotData() != null && base.GetBotData().RandomSpeech.Count > 0) { RandomSpeech Speech = base.GetBotData().GetRandomSpeech(); GetRoomUser().Chat(null, Speech.Message, Speech.Shout); } this.SpeechTimer = PhoenixEnvironment.GetRandomNumber(0, 150); } else { this.SpeechTimer--; } if (this.ActionTimer <= 0) { int randomX = PhoenixEnvironment.GetRandomNumber(0, base.GetRoom().Model.MapSizeX); int randomY = PhoenixEnvironment.GetRandomNumber(0, base.GetRoom().Model.MapSizeY); base.GetRoomUser().MoveTo(randomX, randomY); this.ActionTimer = PhoenixEnvironment.GetRandomNumber(0, 30); } else { this.ActionTimer--; } }
public void parse(GameClient Session, ClientMessage Event) { Dictionary <Room, int> dictionary = PhoenixEnvironment.GetGame().GetRoomManager().method_21(); Room @class = null; IEnumerable <Room> arg_35_0 = dictionary.Keys; if (FindNewFriendsMessageEvent.func_0 == null) { FindNewFriendsMessageEvent.func_0 = new Func <Room, int>(FindNewFriendsMessageEvent.smethod_0); } IOrderedEnumerable <Room> orderedEnumerable = arg_35_0.OrderByDescending(FindNewFriendsMessageEvent.func_0); int num = 0; foreach (Room current in orderedEnumerable) { num++; string a = PhoenixEnvironment.GetRandomNumber(1, 5).ToString(); if (a == "2") { goto IL_83; } if (num == orderedEnumerable.Count <Room>()) { goto IL_83; } bool arg_A2_0 = true; IL_A2: if (arg_A2_0) { continue; } @class = current; break; IL_83: arg_A2_0 = (Session.GetHabbo().CurrentRoom == null || Session.GetHabbo().CurrentRoom == current); goto IL_A2; } if (@class == null) { ServerMessage Message = new ServerMessage(831u); Message.AppendBoolean(false); Session.SendMessage(Message); } else { ServerMessage Message2 = new ServerMessage(286u); Message2.AppendBoolean(@class.IsPublic); Message2.AppendUInt(@class.RoomId); Session.SendMessage(Message2); ServerMessage Message3 = new ServerMessage(831u); Message3.AppendBoolean(true); Session.SendMessage(Message3); } }
private void PetMove(int X, int Y, bool Random) { RoomUser RoomUser = base.GetRoomUser(); if (Random) { int randomX = PhoenixEnvironment.GetRandomNumber(0, base.GetRoom().Model.MapSizeX); int randomY = PhoenixEnvironment.GetRandomNumber(0, base.GetRoom().Model.MapSizeY); RoomUser.MoveTo(randomX, randomY); } else if (X < base.GetRoom().Model.MapSizeX&& Y < base.GetRoom().Model.MapSizeY&& X >= 0 && Y >= 0) { RoomUser.MoveTo(X, Y); } }
public RoomAdvertisement GetRandomRoomAdvertisement() { if (this.RoomAdvertisements.Count <= 0) { return(null); } else { int i; do { i = PhoenixEnvironment.GetRandomNumber(0, this.RoomAdvertisements.Count - 1); }while (this.RoomAdvertisements[i] == null || this.RoomAdvertisements[i].ExceededLimit); return(RoomAdvertisements[i]); } }
public override void OnTimerTick() { if (this.SpeechTimer <= 0) { if (base.GetBotData().RandomSpeech.Count > 0) { RandomSpeech Speech = base.GetBotData().GetRandomSpeech(); base.GetRoomUser().Chat(null, Speech.Message, Speech.Shout); } this.SpeechTimer = PhoenixEnvironment.GetRandomNumber(10, 300); } else { this.SpeechTimer--; } if (this.ActionTimer <= 0) { int randomX = 0; int randomY = 0; switch (GetBotData().WalkingMode.ToLower()) { default: case "stand": // (8) Why is my life so boring? break; case "freeroam": randomX = PhoenixEnvironment.GetRandomNumber(0, GetRoom().Model.MapSizeX); randomY = PhoenixEnvironment.GetRandomNumber(0, GetRoom().Model.MapSizeY); GetRoomUser().MoveTo(randomX, randomY); break; case "specified_range": randomX = PhoenixEnvironment.GetRandomNumber(GetBotData().minX, GetBotData().maxX); randomY = PhoenixEnvironment.GetRandomNumber(GetBotData().minY, GetBotData().maxY); GetRoomUser().MoveTo(randomX, randomY); break; } ActionTimer = PhoenixEnvironment.GetRandomNumber(1, 30); } else { this.ActionTimer--; } }
private int LevelStake() { RoomUser roomUser = base.GetRoomUser(); int randomNumber = 5; if (roomUser.PetData.Level >= 1) { randomNumber = PhoenixEnvironment.GetRandomNumber(1, 8); } if (roomUser.PetData.Level >= 5) { randomNumber = PhoenixEnvironment.GetRandomNumber(1, 7); } if (roomUser.PetData.Level >= 10) { randomNumber = PhoenixEnvironment.GetRandomNumber(1, 6); } return(randomNumber); }
public override void OnTimerTick() { if (SpeechTimer <= 0) { RoomUser Pet = base.GetRoomUser(); string[] PetDog = new string[] { TextManager.GetText("pet_chatter_dog1"), TextManager.GetText("pet_chatter_dog2"), TextManager.GetText("pet_chatter_dog3"), TextManager.GetText("pet_chatter_dog4"), TextManager.GetText("pet_chatter_dog5") }; string[] PetCat = new string[] { TextManager.GetText("pet_chatter_cat1"), TextManager.GetText("pet_chatter_cat2"), TextManager.GetText("pet_chatter_cat3"), TextManager.GetText("pet_chatter_cat4"), TextManager.GetText("pet_chatter_cat5") }; string[] PetCroc = new string[] { TextManager.GetText("pet_chatter_croc1"), TextManager.GetText("pet_chatter_croc2"), TextManager.GetText("pet_chatter_croc3"), TextManager.GetText("pet_chatter_croc4"), TextManager.GetText("pet_chatter_croc5") }; string[] PetDogg = new string[] { TextManager.GetText("pet_chatter_dog1"), TextManager.GetText("pet_chatter_dog2"), TextManager.GetText("pet_chatter_dog3"), TextManager.GetText("pet_chatter_dog4"), TextManager.GetText("pet_chatter_dog5") }; string[] PetBear = new string[] { TextManager.GetText("pet_chatter_bear1"), TextManager.GetText("pet_chatter_bear2"), TextManager.GetText("pet_chatter_bear3"), TextManager.GetText("pet_chatter_bear4"), TextManager.GetText("pet_chatter_bear5") }; string[] PetPig = new string[] { TextManager.GetText("pet_chatter_pig1"), TextManager.GetText("pet_chatter_pig2"), TextManager.GetText("pet_chatter_pig3"), TextManager.GetText("pet_chatter_pig4"), TextManager.GetText("pet_chatter_pig5") }; string[] PetLion = new string[] { TextManager.GetText("pet_chatter_lion1"), TextManager.GetText("pet_chatter_lion2"), TextManager.GetText("pet_chatter_lion3"), TextManager.GetText("pet_chatter_lion4"), TextManager.GetText("pet_chatter_lion5") }; string[] PetRhino = new string[] { TextManager.GetText("pet_chatter_rhino1"), TextManager.GetText("pet_chatter_rhino2"), TextManager.GetText("pet_chatter_rhino3"), TextManager.GetText("pet_chatter_rhino4"), TextManager.GetText("pet_chatter_rhino5") }; string[] PetSpider = new string[] { TextManager.GetText("pet_chatter_spider1"), TextManager.GetText("pet_chatter_spider2"), TextManager.GetText("pet_chatter_spider3"), TextManager.GetText("pet_chatter_spider4"), TextManager.GetText("pet_chatter_spider5") }; string[] PetTurtle = new string[] { TextManager.GetText("pet_chatter_turtle1"), TextManager.GetText("pet_chatter_turtle2"), TextManager.GetText("pet_chatter_turtle3"), TextManager.GetText("pet_chatter_turtle4"), TextManager.GetText("pet_chatter_turtle5") }; string[] PetChic = new string[] { TextManager.GetText("pet_chatter_chic1"), TextManager.GetText("pet_chatter_chic2"), TextManager.GetText("pet_chatter_chic3"), TextManager.GetText("pet_chatter_chic4"), TextManager.GetText("pet_chatter_chic5") }; string[] PetFrog = new string[] { TextManager.GetText("pet_chatter_frog1"), TextManager.GetText("pet_chatter_frog2"), TextManager.GetText("pet_chatter_frog3"), TextManager.GetText("pet_chatter_frog4"), TextManager.GetText("pet_chatter_frog5") }; string[] PetDragon = new string[] { TextManager.GetText("pet_chatter_dragon1"), TextManager.GetText("pet_chatter_dragon2"), TextManager.GetText("pet_chatter_dragon3"), TextManager.GetText("pet_chatter_dragon4"), TextManager.GetText("pet_chatter_dragon5") }; string[] PetHorse = new string[] { TextManager.GetText("pet_chatter_horse1"), TextManager.GetText("pet_chatter_horse2"), TextManager.GetText("pet_chatter_horse3"), TextManager.GetText("pet_chatter_horse4"), TextManager.GetText("pet_chatter_horse5") }; string[] PetMonkey = new string[] { TextManager.GetText("pet_chatter_monkey1"), TextManager.GetText("pet_chatter_monkey2"), TextManager.GetText("pet_chatter_monkey3"), TextManager.GetText("pet_chatter_monkey4"), TextManager.GetText("pet_chatter_monkey5") }; string[] PetGeneric = new string[] { TextManager.GetText("pet_chatter_generic1"), TextManager.GetText("pet_chatter_generic2"), TextManager.GetText("pet_chatter_generic3"), TextManager.GetText("pet_chatter_generic4"), TextManager.GetText("pet_chatter_generic5") }; string[] array17 = new string[] { "sit", "lay", "snf", "ded", "jmp", "snf", "sit", "snf" }; string[] array18 = new string[] { "sit", "lay" }; string[] array19 = new string[] { "wng", "grn", "flm", "std", "swg", "sit", "lay", "snf", "plf", "jmp", "flm", "crk", "rlx", "flm" }; if (Pet != null) { Random RandomSpeech = new Random(); int num = PhoenixEnvironment.GetRandomNumber(1, 4); if (num == 2) { Pet.Statusses.Clear(); if (base.GetRoomUser().BotData.Rider == null) { if (Pet.PetData.Type == 13) { Pet.Statusses.Add(array18[RandomSpeech.Next(0, array18.Length - 1)], Pet.Z.ToString()); } else if (Pet.PetData.Type != 12) { Pet.Statusses.Add(array17[RandomSpeech.Next(0, array17.Length - 1)], Pet.Z.ToString()); } else { Pet.Statusses.Add(array19[RandomSpeech.Next(0, array19.Length - 1)], Pet.Z.ToString()); } } } switch (Pet.PetData.Type) { case 0: Pet.Chat(null, PetDog[RandomSpeech.Next(0, PetDog.Length - 1)], false); break; case 1: Pet.Chat(null, PetCat[RandomSpeech.Next(0, PetCat.Length - 1)], false); break; case 2: Pet.Chat(null, PetCroc[RandomSpeech.Next(0, PetCroc.Length - 1)], false); break; case 3: Pet.Chat(null, PetDogg[RandomSpeech.Next(0, PetDogg.Length - 1)], false); break; case 4: Pet.Chat(null, PetBear[RandomSpeech.Next(0, PetBear.Length - 1)], false); break; case 5: Pet.Chat(null, PetPig[RandomSpeech.Next(0, PetPig.Length - 1)], false); break; case 6: Pet.Chat(null, PetLion[RandomSpeech.Next(0, PetLion.Length - 1)], false); break; case 7: Pet.Chat(null, PetRhino[RandomSpeech.Next(0, PetRhino.Length - 1)], false); break; case 8: Pet.Chat(null, PetSpider[RandomSpeech.Next(0, PetSpider.Length - 1)], false); break; case 9: Pet.Chat(null, PetTurtle[RandomSpeech.Next(0, PetTurtle.Length - 1)], false); break; case 10: Pet.Chat(null, PetChic[RandomSpeech.Next(0, PetChic.Length - 1)], false); break; case 11: Pet.Chat(null, PetFrog[RandomSpeech.Next(0, PetFrog.Length - 1)], false); break; case 12: Pet.Chat(null, PetDragon[RandomSpeech.Next(0, PetDragon.Length - 1)], false); break; case 13: Pet.Chat(null, PetHorse[RandomSpeech.Next(0, PetHorse.Length - 1)], false); break; case 14: Pet.Chat(null, PetMonkey[RandomSpeech.Next(0, PetMonkey.Length - 1)], false); break; default: Pet.Chat(null, PetGeneric[RandomSpeech.Next(0, PetGeneric.Length - 1)], false); break; } } SpeechTimer = PhoenixEnvironment.GetRandomNumber(30, 120); } else { SpeechTimer--; } if (EnergyTimer <= 0) { base.GetRoomUser().PetData.PetEnergy(-10); if (base.GetRoomUser().BotData.Rider == null) { PetMove(0, 0, true); } EnergyTimer = 30; } else { EnergyTimer--; } }
internal void ProcessUpdates() { this.UpdateCounter--; if (this.UpdateCounter <= 0) { this.UpdateNeeded = false; this.UpdateCounter = 0; if (this.TimerRunning && this.int_0 > 0) { this.int_0 += 500; this.GetRoom().int_13 += 500; this.UpdateNeeded = true; if (this.int_0 > SongManager.GetSong(Convert.ToInt32(this.ExtraData)).Length) { ServerMessage Message = new ServerMessage(327); Message.AppendInt32(7); Message.AppendInt32(6); Message.AppendInt32(7); Message.AppendInt32(0); Message.AppendInt32(0); this.GetRoom().SendMessage(Message, null); this.int_0 = 1; this.GetRoom().int_13 = 0; } } else { string text = this.GetBaseItem().InteractionType.ToLower(); switch (text) { case "onewaygate": { RoomUser roomUserByHabbo = null; if (this.InteractingUser > 0) { roomUserByHabbo = this.GetRoom().GetRoomUserByHabbo(this.InteractingUser); } if (roomUserByHabbo != null && roomUserByHabbo.X == this.mX && roomUserByHabbo.Y == this.mY && this.Extra1 != "tried") { this.ExtraData = "1"; this.Extra1 = "tried"; roomUserByHabbo.UnlockWalking(); roomUserByHabbo.MoveTo(this.SquareBehind); this.ReqUpdate(0); this.UpdateState(false, true); } else { if ((roomUserByHabbo != null && (roomUserByHabbo.Coordinate != this.SquareBehind)) || this.Extra1 == "tried") { this.Extra1 = ""; this.ExtraData = "0"; this.InteractingUser = 0; this.UpdateState(false, true); this.GetRoom().GenerateMaps(); } else { if (this.ExtraData == "1") { this.ExtraData = "0"; this.UpdateState(false, true); } } } if (roomUserByHabbo == null) { this.InteractingUser = 0u; } break; } case "teleport": { bool flag = false; bool flag2 = false; if (this.InteractingUser > 0u) { RoomUser roomUserByHabbo = this.GetRoom().GetRoomUserByHabbo(this.InteractingUser); if (roomUserByHabbo != null) { if (!(roomUserByHabbo.Coordinate == this.Coordinate)) { roomUserByHabbo.AllowOverride = false; if (roomUserByHabbo.TeleDelay == -1) { roomUserByHabbo.TeleDelay = 1; } if (TeleHandler.IsTeleLinked(this.Id)) { flag2 = true; if (roomUserByHabbo.TeleDelay == 0) { uint num2 = TeleHandler.GetLinkedTele(this.Id); uint num3 = TeleHandler.GetTeleRoomId(num2); if (num3 == this.RoomId) { RoomItem class2 = this.GetRoom().GetItem(num2); if (class2 == null) { roomUserByHabbo.UnlockWalking(); } else { roomUserByHabbo.SetPos(class2.GetX, class2.GetY, class2.GetZ); roomUserByHabbo.SetRot(class2.Rot); class2.ExtraData = "2"; class2.UpdateState(false, true); class2.InteractingUser2 = this.InteractingUser; } } else { if (!roomUserByHabbo.IsBot) { PhoenixEnvironment.GetGame().GetRoomManager().method_5(new TeleUserData(roomUserByHabbo.GetClient().GetMessageHandler(), roomUserByHabbo.GetClient().GetHabbo(), num3, num2)); } } this.InteractingUser = 0u; } else { roomUserByHabbo.TeleDelay--; } } else { roomUserByHabbo.UnlockWalking(); this.InteractingUser = 0u; roomUserByHabbo.MoveTo(this.SquareInFront); } } else { if ((roomUserByHabbo.Coordinate == this.SquareInFront) && roomUserByHabbo.Item == this) { roomUserByHabbo.AllowOverride = true; flag = true; if (roomUserByHabbo.IsWalking && (roomUserByHabbo.GoalX != this.mX || roomUserByHabbo.GoalY != this.mY)) { roomUserByHabbo.ClearMovement(true); } roomUserByHabbo.CanWalk = false; roomUserByHabbo.AllowOverride = true; roomUserByHabbo.MoveTo(this.Coordinate); } else { this.InteractingUser = 0u; } } } else { this.InteractingUser = 0u; } } if (this.InteractingUser2 > 0u) { RoomUser user2 = this.GetRoom().GetRoomUserByHabbo(this.InteractingUser2); if (user2 != null) { flag = true; user2.UnlockWalking(); if (user2.Coordinate == this.Coordinate) { user2.MoveTo(this.SquareInFront); } } this.InteractingUser2 = 0u; } if (flag) { if (this.ExtraData != "1") { this.ExtraData = "1"; this.UpdateState(false, true); } } else { if (flag2) { if (this.ExtraData != "2") { this.ExtraData = "2"; this.UpdateState(false, true); } } else { if (this.ExtraData != "0") { this.ExtraData = "0"; this.UpdateState(false, true); } } } this.ReqUpdate(1); break; } case "bottle": { int num = PhoenixEnvironment.GetRandomNumber(0, 7); this.ExtraData = num.ToString(); this.UpdateState(); break; } case "dice": try { RoomUser @class = this.GetRoom().GetRoomUserByHabbo(this.InteractingUser); if (@class.GetClient().GetHabbo().Rigger > 0) { this.ExtraData = @class.GetClient().GetHabbo().Rigger.ToString(); @class.GetClient().GetHabbo().Rigger = 0; } else { int num = PhoenixEnvironment.GetRandomNumber(1, 6); this.ExtraData = num.ToString(); } } catch { int num = PhoenixEnvironment.GetRandomNumber(1, 6); this.ExtraData = num.ToString(); } this.UpdateState(); break; case "habbowheel": { int num = PhoenixEnvironment.GetRandomNumber(1, 10); this.ExtraData = num.ToString(); this.UpdateState(); break; } case "loveshuffler": if (this.ExtraData == "0") { int num = PhoenixEnvironment.GetRandomNumber(1, 4); this.ExtraData = num.ToString(); this.ReqUpdate(20); } else { if (this.ExtraData != "-1") { this.ExtraData = "-1"; } } this.UpdateState(false, true); break; case "alert": if (this.ExtraData == "1") { this.ExtraData = "0"; this.UpdateState(false, true); } break; case "vendingmachine": if (this.ExtraData == "1") { RoomUser @class = this.GetRoom().GetRoomUserByHabbo(this.InteractingUser); if (@class != null) { @class.UnlockWalking(); int int_ = this.GetBaseItem().VendingIds[PhoenixEnvironment.GetRandomNumber(0, this.GetBaseItem().VendingIds.Count - 1)]; @class.CarryItem(int_); } this.InteractingUser = 0u; this.ExtraData = "0"; this.UpdateState(false, true); } break; case "wf_trg_onsay": case "wf_trg_enterroom": case "wf_trg_furnistate": case "wf_trg_onfurni": case "wf_trg_offfurni": case "wf_trg_gameend": case "wf_trg_gamestart": case "wf_trg_attime": case "wf_trg_atscore": case "wf_act_saymsg": case "wf_act_togglefurni": case "wf_act_givepoints": case "wf_act_moverotate": case "wf_act_matchfurni": case "wf_act_give_phx": case "wf_cnd_trggrer_on_frn": case "wf_cnd_furnis_hv_avtrs": case "wf_cnd_has_furni_on": case "wf_cnd_phx": case "bb_teleport": if (this.ExtraData == "1") { this.ExtraData = "0"; this.UpdateState(false, true); } break; case "wf_trg_timer": if (this.ExtraData == "1") { this.ExtraData = "0"; this.UpdateState(false, true); } if (this.Extra1.Length > 0) { this.GetRoom().method_15(this); this.ReqUpdate(Convert.ToInt32(Convert.ToDouble(this.Extra1) * 2.0)); } break; case "wf_act_moveuser": if (this.dictionary_1.Count > 0 && this.GetRoom().UserList != null) { int num4 = 0; RoomUser[] RoomUser_ = this.GetRoom().UserList; for (int i = 0; i < RoomUser_.Length; i++) { RoomUser class4 = RoomUser_[i]; if (class4 != null) { if (class4.IsBot) { this.dictionary_1.Remove(class4); } if (this.dictionary_1.ContainsKey(class4)) { if (this.dictionary_1[class4] > 0) { if (this.dictionary_1[class4] == 10 && !class4.IsBot) { class4.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyEffect(4, true); } Dictionary <RoomUser, int> dictionary; RoomUser key; (dictionary = this.dictionary_1)[key = class4] = dictionary[key] - 1; num4++; } else { this.dictionary_1.Remove(class4); class4.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyEffect(0, true); } } } } if (num4 > 0) { this.ReqUpdate(0); } else { this.dictionary_1.Clear(); } } break; case "counter": if (this.TimerRunning && this.Extra1 != "1") { this.ExtraData = Convert.ToString(Convert.ToInt32(this.ExtraData) - 1); if (Convert.ToInt32(this.ExtraData) <= 0) { this.ExtraData = "0"; this.TimerRunning = false; this.GetRoom().method_89(0, this, true); } this.UpdateState(true, true); this.GetRoom().method_16((double)Convert.ToInt32(this.ExtraData)); this.Extra1 = "1"; this.ReqUpdate(1); } else { if (this.TimerRunning) { this.GetRoom().method_16((double)Convert.ToInt32(this.ExtraData) - 0.5); this.Extra1 = "0"; this.ReqUpdate(1); } } break; } } } }
public RandomSpeech GetRandomSpeech() { return(RandomSpeech[PhoenixEnvironment.GetRandomNumber(0, RandomSpeech.Count - 1)]); }