Пример #1
0
        internal void SetNpc(int id)
        {
            if (npcs == null)
            {
                npcs = new SortedList <int, L2Citizen>();
            }

            NpcTemplate t   = NpcTable.getInstance().getNpcTemplate(id);
            L2Citizen   npc = null;

            switch (t.NpcId)
            {
            case 35461:
                npc = new L2HideoutManager(this);
                break;

            case 35462:
                npc = new L2Doormen(this);
                break;
            }

            npc.setTemplate(t);

            StructureSpawn ss = StructureTable.getInstance().getSpawn(id);

            npc.X       = ss.x;
            npc.Y       = ss.y;
            npc.Z       = ss.z;
            npc.Heading = ss.heading;

            npcs.Add(t.NpcId, npc);
        }
Пример #2
0
 public static void PublishConversionRouteNeighbors(StructureTable table)
 {
     if (table == null)
     {
         throw new ArgumentNullException("table");
     }
     table.AddStructure(_structureId, _router, typeof(IntegerValue));
 }
Пример #3
0
 public static void PublishConversionRouteNeighbors(StructureTable table)
 {
     if (table == null)
     {
         throw new ArgumentNullException("table");
     }
     table.AddStructure(_structureId, _router, typeof(PositiveInfinitySymbol));
 }
Пример #4
0
 public Library(Context context)
 {
     this.context        = context;
     this.entityTable    = new EntityTable();
     this.archTable      = new ArchitectureTable();
     this.theoremTable   = new TheoremTable();
     this.structureTable = new StructureTable();
 }
Пример #5
0
    /**
     * Test a StructureTable class.
     */
    public static void Test()
    {
        /*
         * StructureTable stt = new StructureTable ();
         *
         * List<string> gids =  new List<string>();
         * List<string> posIDs = new List<string>(){"1:1:1", "1:2:3", "5:1:9", "7:8:0", "9:4:1"};
         * for (int i = 0; i < 5; ++i) {
         *      gids.Add(i.ToString()); //UUID.randomUUID().tostring()
         * }
         */

        string         res = "";
        StructureTable stt = new StructureTable();

        List <string> gids   = new List <string>();
        List <string> posIDs = new List <string>()
        {
            "1:1:1", "1:2:3", "5:1:9", "7:8:0", "9:4:1"
        };

        for (int i = 0; i < 5; ++i)
        {
            gids.Add(i.ToString());             //UUID.randomUUID().tostring()
        }

        /*
         * stt.create(gids[0]);
         * stt.create(gids[0]); // 既にあるグループを作成
         *
         * stt.join(1L, posIDs[0], gids[0]); //Bug
         * stt.join(2L, posIDs[1], gids[0]);
         * stt.join(3L, posIDs[2], gids[0]);
         * stt.leave(1, 4L, posIDs[1], gids[0]);
         * stt.show("正常な参加・脱退");
         *
         * res = "";
         * stt.join(5L, posIDs[0], gids[1]); // 存在しないグループへの参加
         * stt.leave(1, 5L, posIDs[1], gids[1]); // 参加していないグループからの脱退
         * stt.show("不正な参加・脱退");
         *
         * stt.create(gids[1]);
         * stt.create(gids[2]);
         * stt.create(gids[3]);
         * stt.join(6L, posIDs[0], gids[1]);
         * stt.join(7L, posIDs[3], gids[3]);
         * stt.leave(1, 8L, posIDs[3], gids[3]);
         * stt.show("グループの追加");
         *
         * stt.join(8L, posIDs[1], gids[2]);
         * stt.join(9L, posIDs[1], gids[2]);
         * stt.join(7L, posIDs[1], gids[2]);
         * stt.leave(1, 8L, posIDs[0], gids[0]);
         * stt.leave(1, 10L, posIDs[0], gids[0]);
         * stt.leave(1, 11L, posIDs[0], gids[1]);
         * stt.show("複数のjoin・leaveの収束結果");
         */
    }
Пример #6
0
 public static void PublishConversionRouteNeighbors(StructureTable table)
 {
     if (table == null)
     {
         throw new ArgumentNullException("table");
     }
     table.AddStructure(_structureId, _router, typeof(LogicValue));
     _router.AddSourceNeighbor(IntegerValue.Converter, false, LocalConvertFrom);
 }
Пример #7
0
 public static void PublishConversionRouteNeighbors(StructureTable table)
 {
     if (table == null)
     {
         throw new ArgumentNullException("table");
     }
     table.AddStructure(_structureId, _router, typeof(LiteralValue));
     //router.AddSourceNeighbour(RealValue.Router, true, LocalConvertFrom);
 }
Пример #8
0
 /**
  * ChainVoxelのコンストラクタ
  */
 public ChainVoxel()
 {
     this.atoms             = new SortedDictionary <string, List <Voxel> >();
     this.negativeVoxels    = new SortedDictionary <string, Voxel>();
     this.stt               = new StructureTable();
     this.insertedPosIDs    = new List <string> ();
     this.deletedPosIDs     = new List <string> ();
     ChainVoxel.movedPosIDs = new Dictionary <string, string>();
 }
Пример #9
0
 public static void PublishConversionRouteNeighbors(StructureTable table)
 {
     if (table == null)
     {
         throw new ArgumentNullException("table");
     }
     table.AddStructure(_structureId, _router, typeof(ComplexInfinitySymbol));
     _router.AddSourceNeighbor(NegativeInfinitySymbol.Converter, false, LocalConvertFrom);
     _router.AddSourceNeighbor(PositiveInfinitySymbol.Converter, false, LocalConvertFrom);
 }
Пример #10
0
        public void AppendStructures(StructureTable table)
        {
            StdPackage.Structures.IntegerValue.PublishConversionRouteNeighbors(table);
            StdPackage.Structures.RationalValue.PublishConversionRouteNeighbors(table);
            StdPackage.Structures.RealValue.PublishConversionRouteNeighbors(table);
            StdPackage.Structures.ComplexValue.PublishConversionRouteNeighbors(table);

            StdPackage.Structures.LiteralValue.PublishConversionRouteNeighbors(table);
            StdPackage.Structures.LogicValue.PublishConversionRouteNeighbors(table);
            StdPackage.Structures.ToggleValue.PublishConversionRouteNeighbors(table);

            StdPackage.Structures.UndefinedSymbol.PublishConversionRouteNeighbors(table);
            StdPackage.Structures.NegativeInfinitySymbol.PublishConversionRouteNeighbors(table);
            StdPackage.Structures.PositiveInfinitySymbol.PublishConversionRouteNeighbors(table);
            StdPackage.Structures.ComplexInfinitySymbol.PublishConversionRouteNeighbors(table);
        }
Пример #11
0
    /**
     * ChainVoxelのコンストラクタ
     */
    public ChainVoxel(ChainXController controller)
    {
        this.atoms          = new SortedDictionary <string, List <Voxel> >();
        this.negativeVoxels = new SortedDictionary <string, Voxel>();
        this.stt            = new StructureTable();
        this.controller     = controller;
        this.insertedPosIDs = new List <string>();
        this.deletedPosIDs  = new List <string>();
        this.movedPosIDs    = new Dictionary <string, string>();
        this.joinedGIDs     = new List <string>();
        this.leftGIDs       = new List <string>();

        this.selectedJoinedGIDs = new List <string>();
        this.selectedLeftGIDs   = new List <string>();
        if (!Directory.Exists(Const.SAVED_DIR))
        {
            Directory.CreateDirectory(Const.SAVED_DIR);
        }
    }
Пример #12
0
        public void InitLocalMySQL()
        {
            if (this.Database.CreateIfNotExists())
            {
                EntityGenerator <Address> generatorAddress = new EntityGenerator <Address>();
                for (int i = 0; i < 10; i++)
                {
                    AddressTable.Add(generatorAddress.GenerateItem());
                }

                EntityGenerator <StreetNumber> generatorStreetNumber = new EntityGenerator <StreetNumber>();
                for (int i = 0; i < 20; i++)
                {
                    StreetNumberTable.Add(generatorStreetNumber.GenerateItem());
                }

                EntityGenerator <Employee> generatorEmployee = new EntityGenerator <Employee>();
                for (int i = 0; i < 10; i++)
                {
                    EmployeeTable.Add(generatorEmployee.GenerateItem());
                }

                EntityGenerator <Animal> generatorAnimal = new EntityGenerator <Animal>();
                for (int i = 0; i < 10; i++)
                {
                    AnimalTable.Add(generatorAnimal.GenerateItem());
                }

                EntityGenerator <Job> generatorJob = new EntityGenerator <Job>();
                for (int i = 0; i < 10; i++)
                {
                    JobTable.Add(generatorJob.GenerateItem());
                }

                EntityGenerator <Schedule> generatorSchedule = new EntityGenerator <Schedule>();
                for (int i = 0; i < 10; i++)
                {
                    ScheduleTable.Add(generatorSchedule.GenerateItem());
                }


                EntityGenerator <Structure> generatorStructure = new EntityGenerator <Structure>();
                for (int i = 0; i < 10; i++)
                {
                    StructureTable.Add(generatorStructure.GenerateItem());
                }

                EntityGenerator <Zoo> generatorZoo = new EntityGenerator <Zoo>();
                for (int i = 0; i < 10; i++)

                {
                    ZooTable.Add(generatorZoo.GenerateItem());
                }

                this.SaveChangesAsync();


                AddressTable.Find(1).StreetNumber = StreetNumberTable.Find(1);
                this.SaveChangesAsync();
            }
        }
Пример #13
0
        public void Start()
        {
            Console.Title = "L2dotNET Gameserver";

            CLogger.form();
            Cfg.init("all");

            CharTemplateTable.Instance.Initialize();

            NetworkBlock.getInstance();
            GameTime.getInstance();

            IdFactory.Instance.Initialize();

            L2World.Instance.Initialize();

            // MapRegionTable.getInstance();
            ZoneTable.getInstance();

            NpcTable.getInstance();
            NpcData.getInstance();
            //  SpawnTable.getInstance();
            StaticObjTable.getInstance().read();
            StructureTable.getInstance().read();
            //  TSkillTable.getInstance();
            ItemTable.getInstance();
            ItemHandler.getInstance();
            MultiSell.getInstance();
            Capsule.getInstance();
            RecipeTable.getInstance();

            MonsterRace.getInstance();

            AIManager.getInstance();


            BlowFishKeygen.genKey();
            CLogger.info("generated 20 blowfish keys");

            AdminAccess.Instance.Initialize();;

            QuestManager.getInstance();

            AnnouncementManager.Instance.Initialize();

            AllianceTable.getInstance();
            ClanTable.getInstance();

            CLogger.info("NpcServer: ");
            StaticObjTable.getInstance().Spawn();
            MonsterRace.getInstance().Spawn();
            //  SpawnTable.getInstance().Spawn();
            StructureTable.getInstance().init();

            HtmCache.getInstance();

            AuthThread.getInstance();

            //   GeoData.getInstance();

            CLogger.extra_info("listening game clients on port " + Cfg.SERVER_PORT);
            _listener = new TcpListener(Cfg.SERVER_PORT);
            _listener.Start();

            TcpClient clientSocket = default(TcpClient);

            while (true)
            {
                clientSocket = _listener.AcceptTcpClient();
                accept(clientSocket);
            }
        }
Пример #14
0
    public static void Main(string[] args)
    {
        Voxel.Test();
        StructureTable.Test();
        ChainVoxel.Test();

        Example ex        = new Example();
        string  posID     = "";
        string  destPosID = "1:1:1";
        Random  r         = new Random(1000);

        int receiveOperationNumber             = 400;
        int receiveOperationSleepMillisecond   = 12;
        int updateSelectObjectNumber           = 500;
        int updateSelectObjectSleepMillisecond = 15;

        Thread thread = new Thread(
            () => {
            for (int i = 0; i < receiveOperationNumber; i++)
            {
                /*
                 * Receiveした後の処理
                 */
                lock (Example.thisLock) {
                    string[] xyz_str = destPosID.Split(':');
                    int[] xyz        = new int[3];
                    for (int j = 0; j < 3; j++)
                    {
                        xyz[j] = int.Parse(xyz_str[j]);
                    }

                    posID = String.Format("{0}:{1}:{2}", xyz[0], xyz[1], xyz[2]);
                    xyz[r.Next(3)]++;
                    destPosID = String.Format("{0}:{1}:{2}", xyz[0], xyz[1], xyz[2]);
                    Console.WriteLine("別スレッドだよ: posID=" + posID + ", destPosID=" + destPosID);
                    ex.cv.apply(new Operation(0, Operation.MOVE, posID, destPosID, "Group2"));
                }
                //Thread.Sleep(500); //ユーザのキー操作の速度で処理
                //Thread.Sleep(25); //25のときバグが起こりやすい
                Thread.Sleep(receiveOperationSleepMillisecond);     //ユーザのキー操作の速度で処理
            }
        }
            );

        thread.Start();

        /*
         * Receiveにて更新されたmovedPosIDsを元にdestPosIDを更新
         */
        for (int i = 0; i < updateSelectObjectNumber; i++)
        {
            //send()、ここでの処理は省く
            //sendされた後、receiveで受け取られる。そこから記述している

            lock (Example.thisLock) {
                foreach (KeyValuePair <string, string> aPair in ChainVoxel.movedPosIDs)
                {
                    string posID_tmp     = aPair.Key;
                    string destPosID_tmp = aPair.Value;
                    destPosID = destPosID_tmp;
                    //Console.WriteLine("本体スレッドだよ: destPosID="+ destPosID);
                }
                ChainVoxel.movedPosIDs.Clear();
            }
            Thread.Sleep(updateSelectObjectSleepMillisecond);
        }
    }
Пример #15
0
    /**
     * Test a StructureTable class.
     */
    public static void Test()
    {
        /*
         * StructureTable stt = new StructureTable ();
         *
         * List<string> gids =  new List<string>();
         * List<string> posIDs = new List<string>(){"1:1:1", "1:2:3", "5:1:9", "7:8:0", "9:4:1"};
         * for (int i = 0; i < 5; ++i) {
         *  gids.Add(i.ToString()); //UUID.randomUUID().tostring()
         * }
         *
         * for (int i = 0; i < 5; ++i) {
         *  //System.out.println(posIDs.get(i) + " isGrouped() = " + stt.isGrouped(posIDs.get(i)));
         * }
         */

        string         res = "";
        StructureTable stt = new StructureTable();

        List <string> gids   = new List <string>();
        List <string> posIDs = new List <string>()
        {
            "1:1:1", "1:2:3", "5:1:9", "7:8:0", "9:4:1"
        };

        for (int i = 0; i < 5; ++i)
        {
            gids.Add(i.ToString()); //UUID.randomUUID().tostring()
        }

        stt.create(gids[0]);
        stt.create(gids[0]);              // 既にあるグループを作成

        stt.join(1L, posIDs[0], gids[0]); //Bug
        stt.join(2L, posIDs[1], gids[0]);
        stt.join(3L, posIDs[2], gids[0]);
        stt.leave(1, 4L, posIDs[1], gids[0]);
        //res += stt.getStatusString();

        res = "";
        stt.join(5L, posIDs[0], gids[1]);     // 存在しないグループへの参加
        stt.leave(1, 5L, posIDs[1], gids[1]); // 参加していないグループからの脱退
        //res += stt.getStatusString(); //不正な参加、脱退


        /* Bug */
        stt.create(gids[1]);
        stt.create(gids[2]);
        stt.create(gids[3]);
        stt.join(6L, posIDs[0], gids[1]);
        stt.join(7L, posIDs[3], gids[3]);
        stt.leave(1, 8L, posIDs[3], gids[3]);
        //res += stt.getStatusString(); //グループの追加

        stt.join(8L, posIDs[1], gids[2]);
        stt.join(9L, posIDs[1], gids[2]);
        stt.join(7L, posIDs[1], gids[2]);
        stt.leave(1, 8L, posIDs[0], gids[0]);
        stt.leave(1, 10L, posIDs[0], gids[0]);
        stt.leave(1, 11L, posIDs[0], gids[1]);
        res += stt.getStatusString(); //複数のjoin・leaveの収束結果
        //Console.WriteLine(res);
    }