示例#1
0
 public override bool OnReadyRound(Player plr, Room room)
 {
     var cancel = false;
     foreach (var plugin in Plugins)
     {
         if (plugin.OnReadyRound(plr, room))
             cancel = true;
     }
     return cancel;
 }
示例#2
0
        public override bool OnReadyRound(Player plr, Room room)
        {
            var rule = CheckRule(room);
            if (rule == null) return false;

            if (CheckEquip(plr, rule)) return false;

            var ack = new Packet(EGamePacket.SResultAck);
            ack.Write((uint)EServerResult.WearingUnusbleItem);
            plr.Session.Send(ack);
            return true;
        }
示例#3
0
 private string CheckRule(Room room)
 {
     var name = room.Name;
     return (from entry in _database where name.Contains("CR: NO " + entry.Key) select entry.Key).FirstOrDefault();
 }
示例#4
0
        private void HandleCreateRoom(TcpSession session, Packet p)
        {
            Player player;
            if (!Players.TryGetValue(session.Guid, out player))
            {
                session.StopListening();
                return;
            }
            if (player.Channel == null || player.PublicIP == 0)
                return;

            var room = new Room(Rooms);
            var roomID = Rooms.CreateRoomID(player.Channel.ID);
            var tunnelID = Rooms.CreateTunnelID();

            room.MasterID = player.AccountID;
            room.ID = roomID;
            room.TunnelID = tunnelID;
            room.Channel = player.Channel;
            room.Name = p.ReadCStringBuffer(31);
            room.MatchKey = p.ReadBytes(4);
            room.TimeLimit = p.ReadByte();
            room.TimeLimit *= 60 * 1000;
            room.ScoreLimit = p.ReadByte();
            room.Unk = p.ReadInt32();
            room.Password = p.ReadUInt32();
            room.IsFriendly = p.ReadBoolean();
            room.IsBalanced = p.ReadBoolean();
            room.MinLevel = p.ReadByte();
            room.MaxLevel = p.ReadByte();
            room.EquipLimit = p.ReadByte();
            room.IsNoIntrusion = p.ReadBoolean();
            room.State = EGameRuleState.Waiting;

            var cont = _pluginManager.OnCreateRoom(player, room);
            Packet ack;
            //_logger.Debug("-CCreateRoom- MapID: {0} Mode: {1}", room.MapID, (int)room.GameRule);

            if (!GameDatabase.Instance.IsValidMapID(room.MapID))
            {
                Logger.Error("-CCreateRoom HAX- NOT ALLOWED MapID: {0} Mode: {1}", room.MapID, (int)room.GameRule);
                ack = new Packet(EGamePacket.SResultAck);
                ack.Write((uint)EServerResult.FailedToRequestTask);
                session.Send(ack);
                return;
            }

            if (room.GameRule != EGameRule.Touchdown && room.GameRule != EGameRule.Deathmatch && room.GameRule != EGameRule.Survival && cont)
            {
                ack = new Packet(EGamePacket.SResultAck);
                ack.Write((uint)EServerResult.FailedToRequestTask);
                session.Send(ack);
                return;
            }
            Rooms.TryAdd(tunnelID, room);


            ack = new Packet(EGamePacket.SDeployRoomAck);
            ack.Write(room.ID);
            ack.Write(room.MatchKey);
            ack.Write((byte)room.State);
            ack.Write(room.GetPing()); 
            ack.WriteStringBuffer(room.Name, 31);
            ack.Write(room.PublicType);
            ack.Write(room.TimeLimit);
            ack.Write(room.ScoreLimit);
            ack.Write(room.IsFriendly);
            ack.Write(room.IsBalanced);
            ack.Write(room.MinLevel);
            ack.Write(room.MaxLevel);
            ack.Write(room.EquipLimit);
            ack.Write(room.IsNoIntrusion);

            player.Channel.Broadcast(ack);

            room.Join(player);
        }
示例#5
0
 public override bool OnCreateRoom(Player plr, Room room)
 {
     room.IsBalanced = false;
     return false;
 }
示例#6
0
 public override bool RoomTick(Room room)
 {
     var cancel = false;
     foreach (var plugin in Plugins)
     {
         if (plugin.RoomTick(room))
             cancel = true;
     }
     return cancel;
 }
示例#7
0
 public virtual bool RoomTick(Room room)
 {
     return false;
 }
示例#8
0
 public virtual bool OnReadyRound(Player plr, Room room)
 {
     return false;
 }
示例#9
0
 public virtual bool OnCreateRoom(Player plr, Room room)
 {
     return false;
 }
示例#10
0
 public virtual bool OnBeginRound(Player plr, Room room)
 {
     return false;
 }