コード例 #1
0
 public bool TryConnect(Client client)
 {
     if (Clients.Count >= MaxClient)
         return false;
     else
         return Clients.TryAdd(client.Account.AccountId, client);
 }
コード例 #2
0
ファイル: Vault.cs プロジェクト: Topnenyie/rotmg_svr
        public Vault(bool isLimbo, Client client = null)
        {
            Id = VAULT_ID;
            Name = "Vault";
            Background = 2;
            IsLimbo = isLimbo;

            this.client = client;
        }
コード例 #3
0
ファイル: Server.cs プロジェクト: patrick323/rotmg_svr
 void Listen(IAsyncResult ar)
 {
     var cliSkt = Socket.EndAccept(ar);
     Socket.BeginAccept(Listen, null);
     if (cliSkt != null)
     {
         var client = new Client(Manager, cliSkt);
         client.BeginProcess();
     }
 }
コード例 #4
0
        public int Write(Client client, byte[] buff, int offset)
        {
            MemoryStream s = new MemoryStream(buff, offset + 5, buff.Length - offset - 5);
            Write(client, new NWriter(s));

            int len = (int)s.Position;
            Crypt(client, buff, offset + 5, len);
            Buffer.BlockCopy(BitConverter.GetBytes(IPAddress.HostToNetworkOrder(len + 5)), 0, buff, offset, 4);
            buff[offset + 4] = (byte)ID;
            return len + 5;
        }
コード例 #5
0
ファイル: Vault.cs プロジェクト: Club559/Travs-Domain-Server
        public Vault(bool isLimbo, Client client = null)
        {
            Id = VAULT_ID;
            Name = "Vault";
            Background = 2;
            Difficulty = 0;
            IsLimbo = isLimbo;
            SetMusic("world/Vault");

            this.client = client;
        }
コード例 #6
0
ファイル: Vault.cs プロジェクト: BlackRayquaza/MMOE
 public Vault(bool isLimbo, Client client = null)
 {
     Id = VAULT_ID;
     Name = "Vault";
     Background = 2;
     if (!(IsLimbo = isLimbo))
     {
         base.FromWorldMap(typeof(RealmManager).Assembly.GetManifestResourceStream("wServer.realm.worlds.vault.wmap"));
         Init(client);
     }
 }
コード例 #7
0
 public Vault(bool isLimbo, Client psr = null)
 {
     Id = VAULT_ID;
     Name = "Vault";
     ClientWorldName = "server.Vault";
     Background = 2;
     this.psr = psr;
     this.isLimbo = isLimbo;
     ShowDisplays = true;
     if (psr != null)
         AccountId = psr.Account != null ? psr.Account.AccountId : "-1";
     else
         AccountId = "-1";
 }
コード例 #8
0
ファイル: Player.cs プロジェクト: Topnenyie/rotmg_svr
        public Player(Client client)
            : base(client.Manager, (ushort)client.Character.ObjectType, client.Random)
        {
            this.client = client;
            statsMgr = new StatsManager(this);
            Name = client.Account.Name;
            AccountId = client.Account.AccountId;

            Level = client.Character.Level;
            Experience = client.Character.Exp;
            ExperienceGoal = GetExpGoal(client.Character.Level);
            Stars = GetStars();
            Texture1 = client.Character.Tex1;
            Texture2 = client.Character.Tex2;
            Credits = client.Account.Credits;
            NameChosen = client.Account.NameChosen;
            CurrentFame = client.Account.Stats.Fame;
            Fame = client.Character.CurrentFame;
            var state = client.Account.Stats.ClassStates.SingleOrDefault(_ => _.ObjectType == ObjectType);
            if (state != null)
                FameGoal = GetFameGoal(state.BestFame);
            else
                FameGoal = GetFameGoal(0);
            Glowing = true;
            Guild = "";
            GuildRank = -1;
            HP = client.Character.HitPoints;
            MP = client.Character.MagicPoints;
            ConditionEffects = 0;

            Inventory = new Inventory(this,
                client.Character.Equipment
                    .Select(_ => _ == 0xffff ? null : client.Manager.GameData.Items[_])
                    .ToArray());
            Inventory.InventoryChanged += (sender, e) => CalculateBoost();
            SlotTypes = Utils.FromCommaSepString32(client.Manager.GameData.ObjectTypeToElement[ObjectType].Element("SlotTypes").Value);
            Stats = new int[]
            {
                client.Character.MaxHitPoints,
                client.Character.MaxMagicPoints,
                client.Character.Attack,
                client.Character.Defense,
                client.Character.Speed,
                client.Character.HpRegen,
                client.Character.MpRegen,
                client.Character.Dexterity,
            };
        }
コード例 #9
0
ファイル: Vault.cs プロジェクト: BlackRayquaza/MMOE
        private void Init(Client client)
        {
            this.Client = client;
            this.acc = client.Account;
            List<IntPoint> vaultChestPosition = new List<IntPoint>();
            IntPoint spawn = new IntPoint(0, 0);

            int w = Map.Width;
            int h = Map.Height;
            for (int y = 0; y < h; y++)
                for (int x = 0; x < w; x++)
                {
                    var tile = Map[x, y];
                    if (tile.Region == TileRegion.Spawn)
                        spawn = new IntPoint(x, y);
                    else if (tile.Region == TileRegion.Vault)
                        vaultChestPosition.Add(new IntPoint(x, y));
                }
            vaultChestPosition.Sort((x, y) => Comparer<int>.Default.Compare(
                (x.X - spawn.X) * (x.X - spawn.X) + (x.Y - spawn.Y) * (x.Y - spawn.Y),
                (y.X - spawn.X) * (y.X - spawn.X) + (y.Y - spawn.Y) * (y.Y - spawn.Y)));

            var chests = client.Account.Vault.Chests;
            for (int i = 0; i < chests.Count; i++)
            {
                Container con = new Container(0x0504, null, false);
                var inv = chests[i].Items.Select(_ => _ == -1 ? null : (XmlDatas.ItemDescs.ContainsKey((short)_) ? XmlDatas.ItemDescs[(short)_] : null)).ToArray();
                for (int j = 0; j < 8; j++)
                    con.Inventory[j] = inv[j];
                con.Move(vaultChestPosition[0].X + 0.5f, vaultChestPosition[0].Y + 0.5f);
                EnterWorld(con);
                vaultChestPosition.RemoveAt(0);

                vaultChests[new Tuple<Container, VaultChest>(con, chests[i])] = con.UpdateCount;
            }
            foreach (var i in vaultChestPosition)
            {
                SellableObject x = new SellableObject(0x0505);
                x.Move(i.X + 0.5f, i.Y + 0.5f);
                EnterWorld(x);
            }
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: BlackRayquaza/MMOE
 private static void Listen(IAsyncResult ar)
 {
     Socket skt = null;
     try
     {
         skt = svrSkt.EndAccept(ar);
     }
     catch (ObjectDisposedException)
     {
     }
     try
     {
         svrSkt.BeginAccept(Listen, null);
     }
     catch (ObjectDisposedException)
     {
     }
     if (skt != null)
     {
         var psr = new Client(skt);
         psr.BeginProcess();
     }
 }
コード例 #11
0
ファイル: Shop.cs プロジェクト: BlackRayquaza/MMOE
 public override World GetInstance(Client client)
 {
     return RealmManager.AddWorld(new WineCellarMap());
 }
コード例 #12
0
ファイル: Vault.cs プロジェクト: BlackRayquaza/MMOE
 public override World GetInstance(Client client)
 {
     return RealmManager.AddWorld(new Vault(false, client));
 }
コード例 #13
0
 public void Read(Client client, byte[] body, int offset, int len)
 {
     Crypt(client, body, offset, len);
     Read(client, new NReader(new MemoryStream(body)));
 }
コード例 #14
0
 public override World GetInstance(Client client)
 {
     return Manager.AddWorld(new SnakePit());
 }
コード例 #15
0
 public override void Crypt(Client client, byte[] dat, int offset, int len)
 {
 }
コード例 #16
0
 public override World GetInstance(Client psr)
 {
     return Manager.AddWorld(new LairofShaitan());
 }
コード例 #17
0
 public override World GetInstance(Client psr)
 {
     return Manager.AddWorld(new WineCellar());
 }
コード例 #18
0
 protected abstract void Read(Client client, NReader rdr);
コード例 #19
0
 public void AddPendingPacket(Client client, PacketID id, byte[] packet)
 {
     pendings.Enqueue(new Work(client, id, packet));
 }
コード例 #20
0
 public void AddPendingPacket(Client parrent, Packet pkt)
 {
     pendings.Enqueue(new Work(parrent, pkt));
 }
コード例 #21
0
 protected override void Write(Client client, NWriter wtr)
 {
 }
コード例 #22
0
 protected override void Read(Client client, NReader rdr)
 {
 }
コード例 #23
0
 public override World GetInstance(Client psr)
 {
     return Manager.AddWorld(new PetYard(psr.Player));
 }
コード例 #24
0
ファイル: Sprite.cs プロジェクト: BlackRayquaza/MMOE
 public override World GetInstance(Client client)
 {
     return RealmManager.AddWorld(new SpriteWorld());
 }
コード例 #25
0
 public override World GetInstance(Client client)
 {
     return Manager.AddWorld(new PVPArena());
 }
コード例 #26
0
ファイル: RandRealm.cs プロジェクト: Jankos132/Server-Source
 public override World GetInstance(Client client)
 {
     return Manager.Monitor.GetRandomRealm();
 }
コード例 #27
0
 public NetworkHandler(Client parent, Socket skt)
 {
     this.parent = parent;
     this.skt = skt;
 }
コード例 #28
0
 protected abstract void Write(Client client, NWriter wtr);
コード例 #29
0
 public override World GetInstance(Client psr)
 {
     return Manager.AddWorld(new UndeadLair());
 }
コード例 #30
0
 public override World GetInstance(Client client)
 {
     return Manager.AddWorld(new Tutorial(false));
 }