Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Butterfly.Communication.Packets.Outgoing;
- using Butterfly.HabboHotel.GameClients;
- using Butterfly.HabboHotel.Rooms.Games;
- using System;
- namespace Butterfly.HabboHotel.Rooms.Chat.Commands.Cmd
- {
- class Mordre : IChatCommand
- {
- public void Execute(GameClient Session, Room Room, RoomUser UserRoom, string[] Params)
- {
- if (Params.Length >= 1 && ButterflyEnvironment.ZombieInfectionMode)
- {
- string Username = Params[1];
- bool CanInfect = false;
- GameClient Player = ButterflyEnvironment.GetGame().GetClientManager().GetClientByUsername(Username);
- if (Player == null || Player.GetHabbo() == null || Player.GetHabbo().CurrentRoomId != Session.GetHabbo().CurrentRoomId || Player.GetHabbo().IsZombie)
- return;
- if (!Session.GetHabbo().IsZombie)
- {
- return;
- }
- Room RoomCurrent = Session.GetHabbo().CurrentRoom;
- RoomUser Me = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);
- RoomUser Them = Room.GetRoomUserManager().GetRoomUserByHabbo(Player.GetHabbo().Username);
- if (Room == null || Me == null || Them == null)
- return;
- //if ((Them.X == Me.X - 1) || (Them.X == Me.X + 1) || (Them.Y == Me.Y - 1) || (Them.Y == Me.Y + 1))
- if (Them.Y == Me.Y && Them.X == Me.X - 1)
- {
- CanInfect = true;
- }
- else if (Them.X == Me.X && Them.Y == Me.Y - 1)
- {
- CanInfect = true;
- }
- else if (Them.X == Me.X && Them.Y == Me.Y + 1)
- {
- CanInfect = true;
- }
- else if (Them.Y == Me.Y && Them.X == Me.X + 1)
- {
- CanInfect = true;
- }
- if (CanInfect)
- {
- string[] SplitLook = Player.GetHabbo().Look.Split('.');
- string FullFaceCode = String.Empty;
- string FaceType = String.Empty;
- string FaceColor = String.Empty;
- int CurrentLoop = 1;
- foreach (string LookCode in SplitLook)
- {
- if (LookCode.StartsWith("hd"))
- {
- FullFaceCode = LookCode;
- string[] SplitFace = new string[3];
- SplitFace = LookCode.Split('-');
- foreach (string FaceCode in SplitFace)
- {
- if (CurrentLoop == 1)
- {
- CurrentLoop += 1;
- continue;
- }
- else if (CurrentLoop == 2)
- {
- FaceType = FaceCode;
- CurrentLoop += 1;
- continue;
- }
- else if (CurrentLoop == 3)
- {
- FaceColor = FaceCode;
- break;
- }
- }
- }
- }
- Player.GetHabbo().LookBeforeWorking = Player.GetHabbo().Look;
- Player.GetHabbo().Look = Player.GetHabbo().Look.Replace(FullFaceCode, "hd-" + FaceType + "-97545");
- Me.SendWhisperChat(" "+ Session + "* vient d'infecter " + Player.GetHabbo().Username + " ! *");
- Them.SendWhisperChat(" "+Player + " * est maintenant un Zombie*");
- ServerPacket RoomUpdate = new ServerPacket(ServerPacketHeader.UserChangeMessageComposer);
- RoomUpdate.WriteInteger(Them.VirtualId);
- RoomUpdate.WriteString(Player.GetHabbo().Look);
- RoomUpdate.WriteString(Player.GetHabbo().Gender.ToLower());
- RoomUpdate.WriteString(Player.GetHabbo().Motto);
- RoomUpdate.WriteInteger(Player.GetHabbo().AchievementPoints);
- Room.SendPacket(RoomUpdate);
- Player.GetHabbo().IsZombie = true;
- Player.GetHabbo().HitPoints = 300;
- Player.SendNotification("You are now a Zombie. To infect other players, type :infect [username]");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement