Exemplo n.º 1
0
        public static void SetCreator(BattlegroundId id, string typeName)
        {
            var type     = RealmServer.GetType(typeName);
            var template = GetTemplate(id);

            if (type == null || template == null)
            {
                //throw new ArgumentException("Invalid Creator for type \"" + id + "\": " + typeName);
                object cause, causer;
                if (type == null)
                {
                    cause  = "type";
                    causer = string.Format("({0}) - Please correct it in the Battleground-config file: {1}",
                                           typeName,
                                           BattlegroundConfig.Filename);
                }
                else
                {
                    cause  = "Template";
                    causer = "******";
                }
                log.Warn("Battleground {0} has invalid {1} {2}", id, cause, causer);
            }
            else
            {
                var producer = AccessorMgr.GetOrCreateDefaultProducer(type);
                template.Creator = () => (Battleground)producer.Produce();
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Runtime.getRuntime().addShutdownHook(new Thread(Run));
            ConsoleWriter.clear();
            ConsoleWriter.setTitle("Cyon Remake - Cargando...");
            ConsoleWriter.println("==============================================================\n");
            ConsoleWriter.println(makeHeader());
            ConsoleWriter.println("==============================================================\n");
            ConsoleWriter.println("Cargando la configuracion..");
            loadConfiguration();
            isInit = true;
            ConsoleWriter.println("configuracion lista.");
            ConsoleWriter.println("Conectandose con MySQL server.");
            if (SQLManager.setUpConnexion())
            {
                ConsoleWriter.println("Conexion lista.");
            }
            else
            {
                ConsoleWriter.println("Conexion invalida.");
                closeServers();
                Environment.Exit(0);
            }
            ConsoleWriter.println("Creando el mundo.\n");
            var startTime = TimeSpan.FromMilliseconds(Environment.TickCount); //System.currentTimeMillis();

            World.createWorld();
            var differenceTime = startTime.ToString("ss");

            ConsoleWriter.println("\nEmulator listo en : " + differenceTime + " s");
            isRunning = true;
            ConsoleWriter.println("==============================================================\n");
            //ConsoleWriter.println("Esperando conexiones entrantes, puerto de juego: " + CONFIG_GAME_PORT);
            string Ip = "";

            try
            {
                Ip = InetAddress.getLocalHost().getHostAddress();
            }
            catch (Exception e)
            {
                ConsoleWriter.println(e.Message);
                try
                {
                    Thread.Sleep(10000);
                }
                catch (Exception e1) { }
                Console.ReadKey();
                Environment.Exit(1);
            }
            Ip         = IP;
            gameServer = new GameServer(Ip);

            realmServer = new RealmServer();
            ConsoleWriter.println("IP du serveur: " + IP);
            //refreshTitle();
            //EmuStart();¿
            GC.Collect();
        }
Exemplo n.º 3
0
 public override void OnDamageDealt(RealmServer.Misc.IDamageAction action)
 {
     if (action.Spell == SpellHandler.Get(SpellId.VoidBlast))
     {
         m_owner.Say(m_owner.Target.Name + " shifts into the void...");
         base.OnDamageDealt(action);
     }
 }
Exemplo n.º 4
0
 protected override void Apply(RealmServer.Entities.WorldObject target)
 {
     var chr = target as Character;
     if(chr != null)
     {
         chr.Auras.RemoveWhere(aura => SpellConstants.MoveMechanics[(int)aura.Spell.Mechanic] || aura.Handlers.Any(handler => SpellConstants.MoveMechanics[(int)handler.SpellEffect.Mechanic]) && !aura.IsBeneficial);
     }
     base.Apply(target);
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Thanks to vWoW team.");
            RealmServer rs = new RealmServer();

            rs.Start();
            //WorldServer wowconnector = new WorldServer();
            //wowconnector.Start();
            Console.ReadKey(false);
        }
Exemplo n.º 6
0
        public static void SetCreator(MapId id, string typeName)
        {
            var type = RealmServer.GetType(typeName);

            if (type == null)
            {
                log.Warn("Invalid Creator for Instance \"" + id + "\": " + typeName + "  - " +
                         "Please correct it in the Instance-config file: " + InstanceConfig.Filename);
                return;
            }
            var producer = AccessorMgr.GetOrCreateDefaultProducer(type);

            SetCreator(id, () => (BaseInstance)producer.Produce());
        }
Exemplo n.º 7
0
        /// <summary>
        /// Asynchronously creates a new client and starts its connection to the game servers
        /// </summary>
        public void Start()
        {
            chatServer  = new ChatServer(settings, settings.BotNames[ClientIndex]);
            realmServer = new RealmServer(settings, settings.BotNames[ClientIndex]);
            gameServer  = new GameServer(settings, settings.BotNames[ClientIndex]);

            chatServerThread = new Thread(() =>
            {
                chatServer.Run(null);
            });

            realmServerThread = new Thread((args) =>
            {
                realmServer.Run(args);
            });

            gameServerThread = new Thread((args) =>
            {
                gameServer.Run(args);
            });

            // Named threads for debugging purposes only
            chatServerThread.Name  = "CHAT:" + CharacterName;
            realmServerThread.Name = "REALM:" + CharacterName;
            gameServerThread.Name  = "GAME:" + CharacterName;

            chatServerThread.IsBackground  = true;
            realmServerThread.IsBackground = true;
            gameServerThread.IsBackground  = true;

            chatServer.ReadyToConnectToRealmServer += new EventHandler <RealmServerArgs>(chatServer_ReadyToConnectToRealmServer);
            chatServer.OnFailure += new EventHandler <FailureArgs>(chatServer_OnFailure);

            realmServer.ReadyToConnectToGameServer += new EventHandler <GameServerArgs>(realmServer_ReadyToConnectToGameServer);
            realmServer.OnDisconnect += new EventHandler(realmServer_OnDisconnect);
            realmServer.OnFailure    += new EventHandler <FailureArgs>(realmServer_OnFailure);

            gameServer.OnEnterGame          += new EventHandler(gameServer_OnEnterGame);
            gameServer.OnDisconnect         += new EventHandler(gameServer_OnDisconnect);
            gameServer.OnFailure            += new EventHandler <FailureArgs>(gameServer_OnFailure);
            gameServer.OnPlayerCountChanged += new EventHandler <PlayerCountArgs>(gameClient_OnPlayerCountChanged);
            gameServer.OnShutdown           += new EventHandler(gameServer_OnShutdown);

            IsRunning = true;
            chatServerThread.Start();
        }
Exemplo n.º 8
0
 /// <summary>Create an realm client for a given server.</summary>
 /// <param name="server">reference to the parent RealmServer</param>
 public RealmClient(RealmServer server)
     : base(server)
 {
 }
Exemplo n.º 9
0
 protected override void Apply(RealmServer.Entities.WorldObject target)
 {
     var chr = target as Character;
     if(chr != null)
     {
         foreach(var line in spellsWithoutGlyph)
         {
             line.Apply(spell =>
             {
                 if(chr.Spells.Contains(spell.Id))
                 { 
                     chr.Spells.ClearCooldown(spell, false);
                 }
             });
         }
         if (chr.Spells.Contains(SpellId.GlyphOfPreparation) || chr.Spells.Contains(SpellId.GlyphOfPreparation_2))
         {
             foreach (var line in spellsWithGlyph)
             {
                 line.Apply(spell =>
                 {
                     if (chr.Spells.Contains(spell.Id))
                     {
                         chr.Spells.ClearCooldown(spell, false);
                     }
                 });
             }
         }
     }
 }
Exemplo n.º 10
0
		/// <summary>
		/// Create an realm client for a given server.
		/// </summary>
		/// <param name="server">reference to the parent RealmServer</param>
		public RealmClient(RealmServer server)
			: base(server)
		{
		}
Exemplo n.º 11
0
        void RealmProxy_OnJoinGameResponse(RealmServer.JoinGameResponse packet, ref PacketFlag flag)
        {
            if (packet.Result == RealmServer.JoinGameResult.Sucess)
            {
                this.GameAddress = packet.GameServerIP;
                this.GamePort = 4000;

                flag = PacketFlag.PacketFlag_Hidden;

                byte[] patchedBytes = packet.PatchedByteArray();
                this.SendToDiablo(patchedBytes);
            }
        }
Exemplo n.º 12
0
		public override void OnProc(RealmServer.Entities.Unit target, IUnitAction action)
		{
			var dmgAction = action as DamageAction;
			if (dmgAction == null) return;
			dmgAction.MarkInUse();
			Owner.AddMessage(() =>
			{
				var nextTarget = Owner.GetRandomUnit(Owner.MaxAttackRange, unit => Owner.MayAttack(unit) && unit != target);
				if (nextTarget != null)
				{
					dmgAction.Victim = nextTarget;
					dmgAction.SpellEffect = m_spellEffect;
					target.DoRawDamage(dmgAction);
				}
			});
		}
Exemplo n.º 13
0
		public override void OnDamageDealt(RealmServer.Misc.IDamageAction action)
		{
            if (action.Spell == SpellHandler.Get(SpellId.WhirlwindRank1))
			{
				base.OnDamageDealt(action);
			}
		}