Register for your free account! | Forgot your password?

Go Back   elitepvpers > Other Online Games > Browsergames > DarkOrbit
You last visited: Today at 22:01

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] Orbit Reborn - Source

Discussion on [Release] Orbit Reborn - Source within the DarkOrbit forum part of the Browsergames category.

Reply
 
Old 11/01/2014, 11:06   #271
 
somalia_'s Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 166
Received Thanks: 128
Quote:
Originally Posted by supraturbo92 View Post
hi guys,
so i was looking thru the emulator and fond this:

dont b-b-b-b-bash me bash me im still learning.
but is this x1 x2 x3 x4 sab ammo?
if i ad case 6, multi 6 is that for rsb?

thanks for ur time.
Punching ppl with a Wall-of-Text you want help from isn't cool.

Read the f*cking manual.

Check Usages of 'Session.CharacterInfo.SelectedAmmo' to find out what SelectedAmmo is and where it is used at.

If you add case 6 with 'Damagemultiplier' of 6 well.. Check the line below the switch Statement.
Code:
int Damage = Random.Next(MinDmg, MaxDmg) * DamageMultiplier;
somalia_ is offline  
Old 11/01/2014, 11:07   #272
 
xelle's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 101
Received Thanks: 6
Hello I installed the orbital-reborn server but some errors occurred and I want to fix them in a batch format your help.

MySQL information.



Web site IP address



Now can you tell me where I made mistakes by checking the following photos ?

My inventory.php



My shipAnim.php



My database.php



My paths.php



My index.php



My server.php



My maps.php



My gameserver.es



OrbitReborn Emulator Scractch server - server-main.cfg



İnventory Error



Shop Error



Emulator Error



Waiting for your help please
xelle is offline  
Old 11/01/2014, 11:12   #273
 
elite*gold: 0
Join Date: Oct 2014
Posts: 42
Received Thanks: 0
ok thanks mate i dont know y it went bbb bash lol
supraturbo92 is offline  
Old 11/01/2014, 11:16   #274
 
PRΞĐΛTØR's Avatar
 
elite*gold: 110
Join Date: May 2012
Posts: 275
Received Thanks: 903
Quote:
Originally Posted by xelle View Post
Hello I installed the orbital-reborn server but some errors occurred and I want to fix them in a batch format your help.

MySQL information.



Web site IP address



Now can you tell me where I made mistakes by checking the following photos ?

My inventory.php



My shipAnim.php



My database.php



My paths.php



My index.php



My server.php



My maps.php



My gameserver.es



OrbitReborn Emulator Scractch server - server-main.cfg



İnventory Error



Shop Error



Emulator Error



Waiting for your help please

You also want a coffee?
PRΞĐΛTØR is offline  
Old 11/01/2014, 12:04   #275
 
elite*gold: 0
Join Date: Sep 2014
Posts: 54
Received Thanks: 11


Why Spaceball Dont Work ?
LEJYONER(PvP) is offline  
Old 11/01/2014, 12:46   #276
 
steppdroid's Avatar
 
elite*gold: 0
Join Date: Sep 2014
Posts: 280
Received Thanks: 42
chat does not work .. why ?! work only in local.
I have modified with my ip the file www/view/internalMap/index.php

PHP Code:
chatHost=MYSERVERIP&useHash=0&host=MYSERVERIP
Quote:
Originally Posted by LEJYONER(PvP) View Post


Why Spaceball Dont Work ?
Remplace you Spaceball.cs with this!

Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Data;
using System.Linq;
using System.Windows;

using OrbitReborn_Emulator.Specialized;
using OrbitReborn_Emulator.Storage;
using OrbitReborn_Emulator.Game.Sessions;
using OrbitReborn_Emulator.Communication;
using OrbitReborn_Emulator.Communication.Outgoing;
using OrbitReborn_Emulator.Util;
using OrbitReborn_Emulator.Game.Maps;
using OrbitReborn_Emulator.Game.Npcs;




namespace OrbitReborn_Emulator.Game.Event
{
    public static class Spaceball
    {
        private static int mId;
        private static bool mActive;
        private static int mMMOScore;
        private static int mEICScore;
        private static int mVRUScore;
        private static int mMoveToFirm;
        private static int mBallSpeed;
        private static int mDamageMMO;
        private static int mDamageEIC;
        private static int mDamageVRU;
        private static int mMostDamage;
        private static bool mIsMoving;
        private static int mLastMoveToFirm;
        private static int mLastBallSpeed;
        private static Timer mPerformUpdate;
        private static Timer mPathFinding;
        private static bool mChangeBallSpeed;
        private static bool mChangeMoveToFirm;

        public static int BallSpeed
        {
            get
            {
                return mBallSpeed;
            }
        }

        public static void Initialize()
        {
            mActive = false;
            mMMOScore = 0;
            mEICScore = 0;
            mVRUScore = 0;
            mMoveToFirm = 0;
            mBallSpeed = 0;
        }

        public static void ShowHud(Session Session)
        {
            if (mActive)
            {
                Session.SendData(PacketComposer.Compose("n", "ssi|" + mMMOScore + "|" + mEICScore + "|" + mVRUScore + "|" + mBallSpeed + "|" + mMoveToFirm));
            }
        }

        public static void SendHud()
        {
            SessionManager.BroadcastToUser(PacketComposer.Compose("n", "ssi|" + mMMOScore + "|" + mEICScore + "|" + mVRUScore + "|" + mBallSpeed +"|" + mMoveToFirm));
        }

        public static void UpdateScore(int FactionId)
        {
            if (FactionId == 1)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "ssc|"+FactionId+"|"+mMMOScore));
            }
            if (FactionId == 2)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "ssc|" + FactionId + "|" + mEICScore));
            }
            if (FactionId == 3)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "ssc|" + FactionId + "|" + mVRUScore));
            }
        }

        public static void UpdateSpeed(int FactionId)
        {
            if (FactionId == 1)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "sss|" + FactionId + "|" + mBallSpeed));
            }
            if (FactionId == 2)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "sss|" + FactionId + "|" + mBallSpeed));
            }
            if (FactionId == 3)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "sss|" + FactionId + "|" + mBallSpeed));
            }
            if (FactionId == 0)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "sss|0|" + mBallSpeed));
            }
        }

        public static void ResetBall(Npc Npc)
        {
            if (mPerformUpdate != null)
            {
                mPerformUpdate.Dispose();
                TimerManager.TimerRunning -= 1;
                mPerformUpdate = null;
            }

            // Try to retrieve Map information
            MapInfo Info = MapInfoLoader.GetMapInfo(16);

            // Load Map instance into the server memory if needed
            if (!MapManager.InstanceIsLoadedForMap(Info.Id))
            {
                MapManager.TryLoadMapInstance(Info.Id);
            }

            MapInstance Instance = MapManager.GetInstanceByMapId(16);

            if (Instance != null)
            {
                Instance.BroadcastMessage(PacketComposer.Compose("K", Npc.Id.ToString()));
                MapActor Actor = Instance.GetActorByReferenceId(mId, MapActorType.AiBot);
                if (Actor != null)
                {
                    Instance.KickNpc(Actor.Id);
                }
                Npc = NpcManager.CreateNewInstance("Spaceball", 16, 210, 130, 442, 1000, 1000, 1000, 1000, 100);
                Instance.AddNpcToMap(Npc);
                mId = Npc.Id;
                mPerformUpdate = new Timer(PerformUpdate, Npc, 0, 5000);
                TimerManager.TimerRunning += 1;
            }
        }

        public static void GiveReward(int FactionId)
        {
            List<Session> SessionUser = SessionManager.SessionsUser;
            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                foreach (Session Session in SessionUser)
                {
                    //Output.WriteLine("iterate");
                    if (Session.CharacterInfo.FactionId == FactionId)
                    {
                        string message = "Spaceball reward : + 10 kills.";
                        Session.SendData(PacketComposer.Compose("A", "STD|" + message));
                        Session.CharacterInfo.AddLog(MySqlClient, message);
                        Session.CharacterInfo.AddKillReward(MySqlClient, 10);
                    }
                }
            }
        }

        public static void CreateSpaceball()
        {
            if (mPerformUpdate != null)
            {
                mPerformUpdate.Dispose();
                TimerManager.TimerRunning -= 1;
                mPerformUpdate = null;
            }
            mActive = true;
            SessionManager.BroadcastToUser(PacketComposer.Compose("n", "ssi|" + mMMOScore + "|" + mEICScore + "|" + mVRUScore + "|" + mBallSpeed + "|" + mMoveToFirm));

            MapInfo Info = MapInfoLoader.GetMapInfo(16);

            if (!MapManager.InstanceIsLoadedForMap(Info.Id))
            {
                MapManager.TryLoadMapInstance(Info.Id);
            }

            MapInstance Instance = MapManager.GetInstanceByMapId(16);
            if (Instance != null)
            {
                Instance.Info.MaxUsers = 20;
                Npc Npc = NpcManager.CreateNewInstance("Spaceball", 16, 210, 130, 442, 1000, 1000, 1000, 1000, 100);
                Instance.AddNpcToMap(Npc);
                mId = Npc.Id;
                mPerformUpdate = new Timer(PerformUpdate, Npc, 0, 5000);
                TimerManager.TimerRunning += 1;
                //Instance.BroadcastMessage(PacketComposer.Compose("C", "-10|1|0||pointer|21000|13000|0|0|0|0|0|0"));
            }

        }

        public static void StopSpaceball()
        {
            mActive = false;
            if (mPerformUpdate != null)
            {
                mPerformUpdate.Dispose();
                TimerManager.TimerRunning -= 1;
                mPerformUpdate = null;
            }
            UpdateSpeed(0);
            MapInstance Instance = MapManager.GetInstanceByMapId(16);
            if (Instance != null)
            {
                Instance.Info.MaxUsers = 0;
                MapActor Actor = Instance.GetActorByReferenceId(mId, MapActorType.AiBot);
                if (Actor != null)
                {
                    Instance.KickNpc(Actor.Id);
                }
            }
        }

        public static void DoDamage(int Damage, int FactionId)
        {
            if (FactionId == 1)
            {
                mDamageMMO += Damage;
            }
            if (FactionId == 2)
            {
                mDamageEIC += Damage;
            }
            if (FactionId == 3)
            {
                mDamageVRU += Damage;
            }
            //Output.WriteLine("dmg : " + Damage);

        }

        private static void PerformUpdate(object state)
        {
            Npc Npc = (Npc)state;

            MapInstance Instance = MapManager.GetInstanceByMapId(16);
            if (Instance == null)
            {
                return;
            }

            //Output.WriteLine("npc is moving : " + Npc.IsMoving);

            int temp;
            int bestfaction;

            if (mDamageMMO > mDamageEIC)
            {
                temp = mDamageMMO;
                bestfaction = 1;
            }
            else
            {
                temp = mDamageEIC;
                bestfaction = 2;
            }

            if (mDamageVRU > temp)
            {
                temp = mDamageVRU;
                bestfaction = 3;
            }

            if (mDamageVRU > 0 || mDamageMMO > 0 || mDamageEIC > 0)
            {
                mMostDamage = temp;
                mMoveToFirm = bestfaction;
            }
            else
            {
                mMostDamage = 0;
                mMoveToFirm = 0;
                mBallSpeed = 0;
            }

            if (mMostDamage <= 10000)
            {
                mBallSpeed = 0;
            }

            if (mMostDamage > 8000)
            {
                mBallSpeed = 1;
            }
            if (mMostDamage > 4000)
            {
                mBallSpeed = 2;
            }
            if (mMostDamage > 1500)
            {
                mBallSpeed = 3;
            }

            //Output.WriteLine("ball speed : " + mBallSpeed);


            if (mBallSpeed == 0 && mBallSpeed != mLastBallSpeed)
            {
                if (mPathFinding != null)
                {
                    mPathFinding.Dispose();
                    TimerManager.TimerRunning -= 1;
                    mPathFinding = null;
                }
                Npc.IsMoving = false;
                Instance.BroadcastMessage(MapShipMovementComposer.Compose(Npc.Id, Npc.LocX*100, Npc.LocY*100, 1000));
            }

            if (mMoveToFirm != mLastMoveToFirm)
            {
                if (mMoveToFirm == 1)
                {
                    Npc.NewLocX = 20;
                    Npc.NewLocY = 130;
                }
                if (mMoveToFirm == 2)
                {
                    Npc.NewLocX = 360;
                    Npc.NewLocY = 20;
                }
                if (mMoveToFirm == 3)
                {
                    Npc.NewLocX = 360;
                    Npc.NewLocY = 250;
                }
                UpdateSpeed(mMoveToFirm);
                mChangeMoveToFirm = true;
            }

            if (mBallSpeed > 0 && mBallSpeed != mLastBallSpeed && mMoveToFirm == mLastMoveToFirm)
            {
                mChangeBallSpeed = true;
            }

            if (mBallSpeed != mLastBallSpeed)
            {
                UpdateSpeed(mMoveToFirm);
            }

            if (mBallSpeed > 0 && !Npc.IsMoving)
            {
                if (mPathFinding != null)
                {
                    mPathFinding.Dispose();
                    TimerManager.TimerRunning -= 1;
                    mPathFinding = null;
                }
                Npc.IsMoving = true;
                Npc.TimeTaken = 1;
                Npc.OldLocX = Npc.LocX;
                Npc.OldLocY = Npc.LocY;
                if (mMoveToFirm == 1)
                {
                    Npc.NewLocX = 20;
                    Npc.NewLocY = 130;
                }
                if (mMoveToFirm == 2)
                {
                    Npc.NewLocX = 360;
                    Npc.NewLocY = 20;
                }
                if (mMoveToFirm == 3)
                {
                    Npc.NewLocX = 360;
                    Npc.NewLocY = 250;
                }
                int deltaX = Npc.LocX * 100 - Npc.NewLocX * 100;
                int deltaY = Npc.LocY * 100 - Npc.NewLocY * 100;
                double distance = (Math.Sqrt(Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2)));
                double timeTaken = (distance / (Npc.ShipSpeed * mBallSpeed)) * 1000;
                timeTaken = timeTaken * 1.03;
                Instance.BroadcastMessage(MapShipMovementComposer.Compose(Npc.Id, Npc.NewLocX * 100, Npc.NewLocY * 100, timeTaken));
                mPathFinding = new Timer(PathFinding, Npc, 0, 235);
                TimerManager.TimerRunning += 1;
            }

            mLastBallSpeed = mBallSpeed;
            mLastMoveToFirm = mMoveToFirm;

            //Output.WriteLine("most damage : " + mMostDamage + " from : " + mMoveToFirm);
            //Output.WriteLine("npc id : " + Npc.Id);
            mDamageMMO = 0;
            mDamageEIC = 0;
            mDamageVRU = 0;
            mMostDamage = 0;
            //mBallSpeed = 0;
        }

        private static void PathFinding(object state)
        {
            Npc Npc = (Npc)state;

            //if (!mActive || mBallSpeed == 0)
            //{
            //    if (mPathFinding != null)
            //    {
            //        mPathFinding.Dispose();
            //        TimerManager.TimerRunning -= 1;
            //        mPathFinding = null;
            //    }
            //}

            //Output.WriteLine("this is running");

            if (!mActive || !Npc.IsMoving)
            {
                if (mPathFinding != null)
                {
                    mPathFinding.Dispose();
                    TimerManager.TimerRunning -= 1;
                    mPathFinding = null;
                }
                return;
            }

            if (mChangeMoveToFirm)
            {
                MapInstance Instance = MapManager.GetInstanceByMapId(16);
                if (Instance != null)
                {
                    mChangeMoveToFirm = false;
                    int LocX = Npc.LocX * 100;
                    int LocY = Npc.LocY * 100;
                    int NewLocX = Npc.NewLocX * 100;
                    int NewLocY = Npc.NewLocY * 100;
                    int deltaX = LocX - NewLocX;
                    int deltaY = LocY - NewLocY;
                    double distance = (Math.Sqrt(Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2)));
                    double timeTaken = (distance / (Npc.ShipSpeed * mBallSpeed) * 1000);
                    timeTaken = timeTaken * 1.03;
                    //Output.WriteLine("new ball speed !");
                    Instance.BroadcastMessage(MapShipMovementComposer.Compose(Npc.Id, NewLocX, NewLocY, timeTaken));
                    Npc.TimeTaken = 1;
                    Npc.OldLocX = Npc.LocX;
                    Npc.OldLocY = Npc.LocY;
                }
            }

            if (mChangeBallSpeed)
            {
                MapInstance Instance = MapManager.GetInstanceByMapId(16);
                if (Instance != null)
                {
                    mChangeBallSpeed = false;
                    int LocX = Npc.LocX * 100;
                    int LocY = Npc.LocY * 100;
                    int NewLocX = Npc.NewLocX * 100;
                    int NewLocY = Npc.NewLocY * 100;
                    int deltaX = LocX - NewLocX;
                    int deltaY = LocY - NewLocY;
                    double distance = (Math.Sqrt(Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2)));
                    double timeTaken = (distance / (Npc.ShipSpeed * mBallSpeed) * 1000);
                    timeTaken = timeTaken * 1.03;
                    //Output.WriteLine("new ball speed !");
                    Instance.BroadcastMessage(MapShipMovementComposer.Compose(Npc.Id, NewLocX, NewLocY, timeTaken));
                    Npc.TimeTaken = 1;
                    Npc.OldLocX = Npc.LocX;
                    Npc.OldLocY = Npc.LocY;
                }
            }


            //Output.WriteLine("pathfinding still running bro.");

            Npc.TimeTaken += 1;
            Vector startpos = new Vector(Npc.OldLocX, Npc.OldLocY);
            Vector endpos = new Vector(Npc.NewLocX, Npc.NewLocY);

            Vector mov_vec = Vector.Subtract(endpos, startpos);


            double mov_vec_len = Math.Sqrt(Math.Pow(mov_vec.X, 2) + Math.Pow(mov_vec.Y, 2));
            Vector result = calculatePosition(ref startpos, ref endpos, (double)Npc.TimeTaken, ((double)Npc.ShipSpeed * mBallSpeed) / 416);
            Vector result_vec = Vector.Subtract(startpos, result);
            double result_mov_len = Math.Sqrt(Math.Pow(result_vec.X, 2) + Math.Pow(result_vec.Y, 2));

            if (result_mov_len > mov_vec_len)
            {
                Npc.IsMoving = false;
                if (mMoveToFirm == 1)
                {
                    mMMOScore += 1;
                    UpdateScore(1);
                }
                if (mMoveToFirm == 2)
                {
                    mEICScore += 1;
                    UpdateScore(2);
                }
                if (mMoveToFirm == 3)
                {
                    mVRUScore += 1;
                    UpdateScore(3);
                }

                GiveReward(mMoveToFirm);

                UpdateSpeed(0);
                ResetBall(Npc);

                //Output.WriteLine("is arrived.");
                if (mPathFinding != null)
                {
                    mPathFinding.Dispose();
                    TimerManager.TimerRunning -= 1;
                    mPathFinding = null;
                }
                return;
            }

            //Output.WriteLine(" " + Npc.Name + " " + Math.Round(result.X) + "/" + Math.Round(result.Y));
            Npc.LocX = (int)Math.Round(result.X);
            Npc.LocY = (int)Math.Round(result.Y);
            //Session TargetUser2 = SessionManager.GetSessionByCharacterId(62);
            //TargetUser2.SendData(PacketComposer.Compose("1", "-10|"+Npc.LocX+"00|"+Npc.LocY+"00"));

            //if (Session.StoppedPlayer || Session.CharacterInfo.Destroy || Session.CharacterInfo.Disconnected)
            //{
            //    if (Session.CharacterInfo.PathFinding != null)
            //    {
            //        Session.CharacterInfo.PathFinding.Dispose();
            //        TimerManager.TimerRunning -= 1;
            //        Session.CharacterInfo.PathFinding = null;
            //    }
            //}

            //Session.CharacterInfo.TmpActiveConfig = Session.CharacterInfo.ActiveConfig;
        }

        private static Vector calculatePosition(ref Vector start_pos, ref Vector end_pos, double time, double speed)
        {
            Vector mov_vec = Vector.Subtract(end_pos, start_pos);

            mov_vec.Normalize();

            Vector delta_vec = mov_vec * time * speed;

            Vector result = Vector.Add(start_pos, delta_vec);
            return result;
        }
    }
}
steppdroid is offline  
Old 11/01/2014, 13:40   #277
 
xelle's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 101
Received Thanks: 6
Quote:
Originally Posted by hugo95=) View Post

You also want a coffee?
I did file settings such problem stems from?
Inventory and shops problematic.
?
xelle is offline  
Old 11/01/2014, 14:14   #278
 
elite*gold: 0
Join Date: May 2013
Posts: 54
Received Thanks: 5

How I can add new button ? ( In : ui.swf ... window1.sfw ... ????? )
BotorCrime is offline  
Old 11/01/2014, 15:30   #279
 
steppdroid's Avatar
 
elite*gold: 0
Join Date: Sep 2014
Posts: 280
Received Thanks: 42
Quote:
Originally Posted by LEJYONER(PvP) View Post


Why Spaceball Dont Work ?
Emulator with spaceball fix


LEJYONER for fix "You've killed .. players" in hall of fame go to www\views\internalStart\index.php and
remplace line 111 with this:
PHP Code:
<span class="menu" style="font-size: 10px">You've killed <?php echo Auth::getUser('user_kill'); ?> players</span>
steppdroid is offline  
Old 11/01/2014, 15:41   #280

 
Destiny's Avatar
 
elite*gold: 2
Join Date: Jun 2012
Posts: 988
Received Thanks: 562
212.67.156.149 test i have bug with eq and shop idk where error i try find
Destiny is offline  
Old 11/01/2014, 15:44   #281
 
elite*gold: 0
Join Date: Sep 2014
Posts: 54
Received Thanks: 11
Quote:
Originally Posted by steppdroid View Post
Emulator with spaceball fix


LEJYONER for fix "You've killed .. players" in hall of fame go to www\views\internalStart\index.php and
remplace line 111 with this:
PHP Code:
<span class="menu" style="font-size: 10px">You've killed <?php echo Auth::getUser('user_kill'); ?> players</span>
Thanks and What Emulator Download Key ?
LEJYONER(PvP) is offline  
Old 11/01/2014, 15:55   #282
 
steppdroid's Avatar
 
elite*gold: 0
Join Date: Sep 2014
Posts: 280
Received Thanks: 42
Quote:
Originally Posted by edox77 View Post
212.67.156.149 test i have bug with eq and shop idk where error i try find
ramplace in www/view/internalDock/index.php
with you ip.
steppdroid is offline  
Old 11/01/2014, 16:31   #283

 
Arby's Avatar
 
elite*gold: 83
Join Date: May 2011
Posts: 11,029
Received Thanks: 6,036
I can understand if you have questions regarding the actual source/files. However, any questions which aren't related to the source (this could be, how do I add this, make this new things, fix this), ask .

This source is a basis and can be used for a guideline towards making your PServer, the people here don't mind helping out if you have problems with the actual source. But questions with problems of coding or whatever needed to be posted .

I'm fine with people asking for help, but you can't expect them to do everything.
Please consider this as a little warning.

I'll try and check this topic when I can, if I see any posts which I believe should be posted in the other thread, they will more than likely be deleted (with other possible consequences).

I'm sure that what linkpad wanted of this thread, as a basis to help people. If I misunderstood the thread, then I apologise, if so, please contact me linkpad. But from what I'm seeing, it serves as a type of guide.
Arby is offline  
Thanks
5 Users
Old 11/01/2014, 17:07   #284
 
elite*gold: 0
Join Date: Nov 2014
Posts: 52
Received Thanks: 74
i don't understand too
WrednYTrainer is offline  
Old 11/01/2014, 18:05   #285
 
linkpad's Avatar
 
elite*gold: 260
Join Date: Jul 2012
Posts: 299
Received Thanks: 812
Quote:
Originally Posted by steppdroid View Post
chat does not work .. why ?! work only in local.
I have modified with my ip the file www/view/internalMap/index.php

PHP Code:
chatHost=MYSERVERIP&useHash=0&host=MYSERVERIP


Remplace you Spaceball.cs with this!

Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Data;
using System.Linq;
using System.Windows;

using OrbitReborn_Emulator.Specialized;
using OrbitReborn_Emulator.Storage;
using OrbitReborn_Emulator.Game.Sessions;
using OrbitReborn_Emulator.Communication;
using OrbitReborn_Emulator.Communication.Outgoing;
using OrbitReborn_Emulator.Util;
using OrbitReborn_Emulator.Game.Maps;
using OrbitReborn_Emulator.Game.Npcs;




namespace OrbitReborn_Emulator.Game.Event
{
    public static class Spaceball
    {
        private static int mId;
        private static bool mActive;
        private static int mMMOScore;
        private static int mEICScore;
        private static int mVRUScore;
        private static int mMoveToFirm;
        private static int mBallSpeed;
        private static int mDamageMMO;
        private static int mDamageEIC;
        private static int mDamageVRU;
        private static int mMostDamage;
        private static bool mIsMoving;
        private static int mLastMoveToFirm;
        private static int mLastBallSpeed;
        private static Timer mPerformUpdate;
        private static Timer mPathFinding;
        private static bool mChangeBallSpeed;
        private static bool mChangeMoveToFirm;

        public static int BallSpeed
        {
            get
            {
                return mBallSpeed;
            }
        }

        public static void Initialize()
        {
            mActive = false;
            mMMOScore = 0;
            mEICScore = 0;
            mVRUScore = 0;
            mMoveToFirm = 0;
            mBallSpeed = 0;
        }

        public static void ShowHud(Session Session)
        {
            if (mActive)
            {
                Session.SendData(PacketComposer.Compose("n", "ssi|" + mMMOScore + "|" + mEICScore + "|" + mVRUScore + "|" + mBallSpeed + "|" + mMoveToFirm));
            }
        }

        public static void SendHud()
        {
            SessionManager.BroadcastToUser(PacketComposer.Compose("n", "ssi|" + mMMOScore + "|" + mEICScore + "|" + mVRUScore + "|" + mBallSpeed +"|" + mMoveToFirm));
        }

        public static void UpdateScore(int FactionId)
        {
            if (FactionId == 1)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "ssc|"+FactionId+"|"+mMMOScore));
            }
            if (FactionId == 2)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "ssc|" + FactionId + "|" + mEICScore));
            }
            if (FactionId == 3)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "ssc|" + FactionId + "|" + mVRUScore));
            }
        }

        public static void UpdateSpeed(int FactionId)
        {
            if (FactionId == 1)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "sss|" + FactionId + "|" + mBallSpeed));
            }
            if (FactionId == 2)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "sss|" + FactionId + "|" + mBallSpeed));
            }
            if (FactionId == 3)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "sss|" + FactionId + "|" + mBallSpeed));
            }
            if (FactionId == 0)
            {
                SessionManager.BroadcastToUser(PacketComposer.Compose("n", "sss|0|" + mBallSpeed));
            }
        }

        public static void ResetBall(Npc Npc)
        {
            if (mPerformUpdate != null)
            {
                mPerformUpdate.Dispose();
                TimerManager.TimerRunning -= 1;
                mPerformUpdate = null;
            }

            // Try to retrieve Map information
            MapInfo Info = MapInfoLoader.GetMapInfo(16);

            // Load Map instance into the server memory if needed
            if (!MapManager.InstanceIsLoadedForMap(Info.Id))
            {
                MapManager.TryLoadMapInstance(Info.Id);
            }

            MapInstance Instance = MapManager.GetInstanceByMapId(16);

            if (Instance != null)
            {
                Instance.BroadcastMessage(PacketComposer.Compose("K", Npc.Id.ToString()));
                MapActor Actor = Instance.GetActorByReferenceId(mId, MapActorType.AiBot);
                if (Actor != null)
                {
                    Instance.KickNpc(Actor.Id);
                }
                Npc = NpcManager.CreateNewInstance("Spaceball", 16, 210, 130, 442, 1000, 1000, 1000, 1000, 100);
                Instance.AddNpcToMap(Npc);
                mId = Npc.Id;
                mPerformUpdate = new Timer(PerformUpdate, Npc, 0, 5000);
                TimerManager.TimerRunning += 1;
            }
        }

        public static void GiveReward(int FactionId)
        {
            List<Session> SessionUser = SessionManager.SessionsUser;
            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                foreach (Session Session in SessionUser)
                {
                    //Output.WriteLine("iterate");
                    if (Session.CharacterInfo.FactionId == FactionId)
                    {
                        string message = "Spaceball reward : + 10 kills.";
                        Session.SendData(PacketComposer.Compose("A", "STD|" + message));
                        Session.CharacterInfo.AddLog(MySqlClient, message);
                        Session.CharacterInfo.AddKillReward(MySqlClient, 10);
                    }
                }
            }
        }

        public static void CreateSpaceball()
        {
            if (mPerformUpdate != null)
            {
                mPerformUpdate.Dispose();
                TimerManager.TimerRunning -= 1;
                mPerformUpdate = null;
            }
            mActive = true;
            SessionManager.BroadcastToUser(PacketComposer.Compose("n", "ssi|" + mMMOScore + "|" + mEICScore + "|" + mVRUScore + "|" + mBallSpeed + "|" + mMoveToFirm));

            MapInfo Info = MapInfoLoader.GetMapInfo(16);

            if (!MapManager.InstanceIsLoadedForMap(Info.Id))
            {
                MapManager.TryLoadMapInstance(Info.Id);
            }

            MapInstance Instance = MapManager.GetInstanceByMapId(16);
            if (Instance != null)
            {
                Instance.Info.MaxUsers = 20;
                Npc Npc = NpcManager.CreateNewInstance("Spaceball", 16, 210, 130, 442, 1000, 1000, 1000, 1000, 100);
                Instance.AddNpcToMap(Npc);
                mId = Npc.Id;
                mPerformUpdate = new Timer(PerformUpdate, Npc, 0, 5000);
                TimerManager.TimerRunning += 1;
                //Instance.BroadcastMessage(PacketComposer.Compose("C", "-10|1|0||pointer|21000|13000|0|0|0|0|0|0"));
            }

        }

        public static void StopSpaceball()
        {
            mActive = false;
            if (mPerformUpdate != null)
            {
                mPerformUpdate.Dispose();
                TimerManager.TimerRunning -= 1;
                mPerformUpdate = null;
            }
            UpdateSpeed(0);
            MapInstance Instance = MapManager.GetInstanceByMapId(16);
            if (Instance != null)
            {
                Instance.Info.MaxUsers = 0;
                MapActor Actor = Instance.GetActorByReferenceId(mId, MapActorType.AiBot);
                if (Actor != null)
                {
                    Instance.KickNpc(Actor.Id);
                }
            }
        }

        public static void DoDamage(int Damage, int FactionId)
        {
            if (FactionId == 1)
            {
                mDamageMMO += Damage;
            }
            if (FactionId == 2)
            {
                mDamageEIC += Damage;
            }
            if (FactionId == 3)
            {
                mDamageVRU += Damage;
            }
            //Output.WriteLine("dmg : " + Damage);

        }

        private static void PerformUpdate(object state)
        {
            Npc Npc = (Npc)state;

            MapInstance Instance = MapManager.GetInstanceByMapId(16);
            if (Instance == null)
            {
                return;
            }

            //Output.WriteLine("npc is moving : " + Npc.IsMoving);

            int temp;
            int bestfaction;

            if (mDamageMMO > mDamageEIC)
            {
                temp = mDamageMMO;
                bestfaction = 1;
            }
            else
            {
                temp = mDamageEIC;
                bestfaction = 2;
            }

            if (mDamageVRU > temp)
            {
                temp = mDamageVRU;
                bestfaction = 3;
            }

            if (mDamageVRU > 0 || mDamageMMO > 0 || mDamageEIC > 0)
            {
                mMostDamage = temp;
                mMoveToFirm = bestfaction;
            }
            else
            {
                mMostDamage = 0;
                mMoveToFirm = 0;
                mBallSpeed = 0;
            }

            if (mMostDamage <= 10000)
            {
                mBallSpeed = 0;
            }

            if (mMostDamage > 8000)
            {
                mBallSpeed = 1;
            }
            if (mMostDamage > 4000)
            {
                mBallSpeed = 2;
            }
            if (mMostDamage > 1500)
            {
                mBallSpeed = 3;
            }

            //Output.WriteLine("ball speed : " + mBallSpeed);


            if (mBallSpeed == 0 && mBallSpeed != mLastBallSpeed)
            {
                if (mPathFinding != null)
                {
                    mPathFinding.Dispose();
                    TimerManager.TimerRunning -= 1;
                    mPathFinding = null;
                }
                Npc.IsMoving = false;
                Instance.BroadcastMessage(MapShipMovementComposer.Compose(Npc.Id, Npc.LocX*100, Npc.LocY*100, 1000));
            }

            if (mMoveToFirm != mLastMoveToFirm)
            {
                if (mMoveToFirm == 1)
                {
                    Npc.NewLocX = 20;
                    Npc.NewLocY = 130;
                }
                if (mMoveToFirm == 2)
                {
                    Npc.NewLocX = 360;
                    Npc.NewLocY = 20;
                }
                if (mMoveToFirm == 3)
                {
                    Npc.NewLocX = 360;
                    Npc.NewLocY = 250;
                }
                UpdateSpeed(mMoveToFirm);
                mChangeMoveToFirm = true;
            }

            if (mBallSpeed > 0 && mBallSpeed != mLastBallSpeed && mMoveToFirm == mLastMoveToFirm)
            {
                mChangeBallSpeed = true;
            }

            if (mBallSpeed != mLastBallSpeed)
            {
                UpdateSpeed(mMoveToFirm);
            }

            if (mBallSpeed > 0 && !Npc.IsMoving)
            {
                if (mPathFinding != null)
                {
                    mPathFinding.Dispose();
                    TimerManager.TimerRunning -= 1;
                    mPathFinding = null;
                }
                Npc.IsMoving = true;
                Npc.TimeTaken = 1;
                Npc.OldLocX = Npc.LocX;
                Npc.OldLocY = Npc.LocY;
                if (mMoveToFirm == 1)
                {
                    Npc.NewLocX = 20;
                    Npc.NewLocY = 130;
                }
                if (mMoveToFirm == 2)
                {
                    Npc.NewLocX = 360;
                    Npc.NewLocY = 20;
                }
                if (mMoveToFirm == 3)
                {
                    Npc.NewLocX = 360;
                    Npc.NewLocY = 250;
                }
                int deltaX = Npc.LocX * 100 - Npc.NewLocX * 100;
                int deltaY = Npc.LocY * 100 - Npc.NewLocY * 100;
                double distance = (Math.Sqrt(Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2)));
                double timeTaken = (distance / (Npc.ShipSpeed * mBallSpeed)) * 1000;
                timeTaken = timeTaken * 1.03;
                Instance.BroadcastMessage(MapShipMovementComposer.Compose(Npc.Id, Npc.NewLocX * 100, Npc.NewLocY * 100, timeTaken));
                mPathFinding = new Timer(PathFinding, Npc, 0, 235);
                TimerManager.TimerRunning += 1;
            }

            mLastBallSpeed = mBallSpeed;
            mLastMoveToFirm = mMoveToFirm;

            //Output.WriteLine("most damage : " + mMostDamage + " from : " + mMoveToFirm);
            //Output.WriteLine("npc id : " + Npc.Id);
            mDamageMMO = 0;
            mDamageEIC = 0;
            mDamageVRU = 0;
            mMostDamage = 0;
            //mBallSpeed = 0;
        }

        private static void PathFinding(object state)
        {
            Npc Npc = (Npc)state;

            //if (!mActive || mBallSpeed == 0)
            //{
            //    if (mPathFinding != null)
            //    {
            //        mPathFinding.Dispose();
            //        TimerManager.TimerRunning -= 1;
            //        mPathFinding = null;
            //    }
            //}

            //Output.WriteLine("this is running");

            if (!mActive || !Npc.IsMoving)
            {
                if (mPathFinding != null)
                {
                    mPathFinding.Dispose();
                    TimerManager.TimerRunning -= 1;
                    mPathFinding = null;
                }
                return;
            }

            if (mChangeMoveToFirm)
            {
                MapInstance Instance = MapManager.GetInstanceByMapId(16);
                if (Instance != null)
                {
                    mChangeMoveToFirm = false;
                    int LocX = Npc.LocX * 100;
                    int LocY = Npc.LocY * 100;
                    int NewLocX = Npc.NewLocX * 100;
                    int NewLocY = Npc.NewLocY * 100;
                    int deltaX = LocX - NewLocX;
                    int deltaY = LocY - NewLocY;
                    double distance = (Math.Sqrt(Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2)));
                    double timeTaken = (distance / (Npc.ShipSpeed * mBallSpeed) * 1000);
                    timeTaken = timeTaken * 1.03;
                    //Output.WriteLine("new ball speed !");
                    Instance.BroadcastMessage(MapShipMovementComposer.Compose(Npc.Id, NewLocX, NewLocY, timeTaken));
                    Npc.TimeTaken = 1;
                    Npc.OldLocX = Npc.LocX;
                    Npc.OldLocY = Npc.LocY;
                }
            }

            if (mChangeBallSpeed)
            {
                MapInstance Instance = MapManager.GetInstanceByMapId(16);
                if (Instance != null)
                {
                    mChangeBallSpeed = false;
                    int LocX = Npc.LocX * 100;
                    int LocY = Npc.LocY * 100;
                    int NewLocX = Npc.NewLocX * 100;
                    int NewLocY = Npc.NewLocY * 100;
                    int deltaX = LocX - NewLocX;
                    int deltaY = LocY - NewLocY;
                    double distance = (Math.Sqrt(Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2)));
                    double timeTaken = (distance / (Npc.ShipSpeed * mBallSpeed) * 1000);
                    timeTaken = timeTaken * 1.03;
                    //Output.WriteLine("new ball speed !");
                    Instance.BroadcastMessage(MapShipMovementComposer.Compose(Npc.Id, NewLocX, NewLocY, timeTaken));
                    Npc.TimeTaken = 1;
                    Npc.OldLocX = Npc.LocX;
                    Npc.OldLocY = Npc.LocY;
                }
            }


            //Output.WriteLine("pathfinding still running bro.");

            Npc.TimeTaken += 1;
            Vector startpos = new Vector(Npc.OldLocX, Npc.OldLocY);
            Vector endpos = new Vector(Npc.NewLocX, Npc.NewLocY);

            Vector mov_vec = Vector.Subtract(endpos, startpos);


            double mov_vec_len = Math.Sqrt(Math.Pow(mov_vec.X, 2) + Math.Pow(mov_vec.Y, 2));
            Vector result = calculatePosition(ref startpos, ref endpos, (double)Npc.TimeTaken, ((double)Npc.ShipSpeed * mBallSpeed) / 416);
            Vector result_vec = Vector.Subtract(startpos, result);
            double result_mov_len = Math.Sqrt(Math.Pow(result_vec.X, 2) + Math.Pow(result_vec.Y, 2));

            if (result_mov_len > mov_vec_len)
            {
                Npc.IsMoving = false;
                if (mMoveToFirm == 1)
                {
                    mMMOScore += 1;
                    UpdateScore(1);
                }
                if (mMoveToFirm == 2)
                {
                    mEICScore += 1;
                    UpdateScore(2);
                }
                if (mMoveToFirm == 3)
                {
                    mVRUScore += 1;
                    UpdateScore(3);
                }

                GiveReward(mMoveToFirm);

                UpdateSpeed(0);
                ResetBall(Npc);

                //Output.WriteLine("is arrived.");
                if (mPathFinding != null)
                {
                    mPathFinding.Dispose();
                    TimerManager.TimerRunning -= 1;
                    mPathFinding = null;
                }
                return;
            }

            //Output.WriteLine(" " + Npc.Name + " " + Math.Round(result.X) + "/" + Math.Round(result.Y));
            Npc.LocX = (int)Math.Round(result.X);
            Npc.LocY = (int)Math.Round(result.Y);
            //Session TargetUser2 = SessionManager.GetSessionByCharacterId(62);
            //TargetUser2.SendData(PacketComposer.Compose("1", "-10|"+Npc.LocX+"00|"+Npc.LocY+"00"));

            //if (Session.StoppedPlayer || Session.CharacterInfo.Destroy || Session.CharacterInfo.Disconnected)
            //{
            //    if (Session.CharacterInfo.PathFinding != null)
            //    {
            //        Session.CharacterInfo.PathFinding.Dispose();
            //        TimerManager.TimerRunning -= 1;
            //        Session.CharacterInfo.PathFinding = null;
            //    }
            //}

            //Session.CharacterInfo.TmpActiveConfig = Session.CharacterInfo.ActiveConfig;
        }

        private static Vector calculatePosition(ref Vector start_pos, ref Vector end_pos, double time, double speed)
        {
            Vector mov_vec = Vector.Subtract(end_pos, start_pos);

            mov_vec.Normalize();

            Vector delta_vec = mov_vec * time * speed;

            Vector result = Vector.Add(start_pos, delta_vec);
            return result;
        }
    }
}
You really don't understand these lines of code :

Code:
            if (mMostDamage <= 10000)
            {
                mBallSpeed = 0;
            }

            if (mMostDamage > 8000)
            {
                mBallSpeed = 1;
            }
            if (mMostDamage > 4000)
            {
                mBallSpeed = 2;
            }
            if (mMostDamage > 1500)
            {
                mBallSpeed = 3;
            }
For all people complaining about spaceball not "working", trust me it does. The spaceball was programmed for a lot of players playing it and not one or two users. How does it works ? It check how many damage players did to the ball every 5secs. If the ball speed is 0, the ball dont move, 3 is the fastest ball speed. Now you know that, you should edit your if statement because as it stand, more damage you do, more slow the ball will be...

Quote:
Originally Posted by steppdroid View Post
Emulator with spaceball fix


LEJYONER for fix "You've killed .. players" in hall of fame go to www\views\internalStart\index.php and
remplace line 111 with this:
PHP Code:
<span class="menu" style="font-size: 10px">You've killed <?php echo Auth::getUser('user_kill'); ?> players</span>
I'm ok with giving a pack of my source but at least provide improvement in it, and a correct one. Not this "false" fix of spaceball.

Quote:
Originally Posted by Arby View Post
I can understand if you have questions regarding the actual source/files. However, any questions which aren't related to the source (this could be, how do I add this, make this new things, fix this), ask .

This source is a basis and can be used for a guideline towards making your PServer, the people here don't mind helping out if you have problems with the actual source. But questions with problems of coding or whatever needed to be posted .

I'm fine with people asking for help, but you can't expect them to do everything.
Please consider this as a little warning.

I'll try and check this topic when I can, if I see any posts which I believe should be posted in the other thread, they will more than likely be deleted (with other possible consequences).

I'm sure that what linkpad wanted of this thread, as a basis to help people. If I misunderstood the thread, then I apologise, if so, please contact me linkpad. But from what I'm seeing, it serves as a type of guide.
You didn't misunderstand the thread, these source I published to the community are here for helping others programmers and not for making a copy of "Orbit Reborn." So yes, post in this thread should be related to coding and not "how to install the server".
linkpad is offline  
Thanks
3 Users
Reply


Similar Threads Similar Threads
[Open Beta] Orbit Reborn - Private Server
10/28/2014 - DarkOrbit - 105 Replies
http://i.epvpimg.com/YgS1f.png Presentation Orbit Reborn is a DarkOrbit private server. This server try to bring back the old gameplay from 2008, that means there's no : PET, RSB, Hellstorm, ... Features - maps 1-1 / 2-1 / 3-1 / 4-1 / 4-2 / 4-3 / 4-4 - rockets : R-310, PLT-2026, PLT-2021
[Selling] Orbit Reborn Acc.
09/20/2014 - Browsergames Trading - 0 Replies
Sellin "a" Orbit Reborn Acc with 275 Kills and Blue Design.^^ 10 e*gold fast deal no probs.^^
[DarkOrbit] Orbit Reborn Private Server
02/28/2014 - DarkOrbit - 4 Replies
Project presentation Orbit Reborn is a private server of the game Dark Orbit. This server is developed only by me and is in Beta test. How to join the server ? You can join Orbit Reborn with this url = orbit-reborn Orbit Reborn have also a TS3=orbit-reborn.com
orbit-reborn.com
01/20/2014 - Browsergames Trading - 1 Replies
Orbit Reborn is the link its a darkorit remake but the old servers meaning just plain ships no pilot points pets rsb just x1,x2,x3,x4,sab its pvp battles private server you just sign up on the link its free to it keeps improving its awesome come join!!!!:rtfm::rtfm::rtfm::rtfm::rtfm:
Orbit Reborn
12/16/2013 - DarkOrbit - 2 Replies
>>Orbit Reborn<< Statut: ONLINE DarkOrbit - Orbit Reborn - YouTube



All times are GMT +1. The time now is 22:01.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.