コード例 #1
0
ファイル: Cube.cs プロジェクト: quotopian/MapleServer2
 public Cube(long uid, Item item, int plotNumber, CoordF coordF, float rotation, long homeLayoutUid, long homeId, CubePortalSettings portalSettings)
 {
     Uid            = uid;
     Item           = item;
     PlotNumber     = plotNumber;
     CoordF         = coordF;
     HomeId         = homeId;
     LayoutUid      = homeLayoutUid;
     Rotation       = CoordF.From(0, 0, rotation);
     PortalSettings = portalSettings;
 }
コード例 #2
0
        protected override List<HomeTemplateMetadata> Parse()
        {
            List<HomeTemplateMetadata> homeTemplates = new List<HomeTemplateMetadata>();
            foreach (PackFileEntry entry in Resources.XmlReader.Files)
            {
                if (!entry.Name.StartsWith("exportedugcmap/"))
                {
                    continue;
                }

                XmlDocument document = Resources.XmlReader.GetXmlDocument(entry);
                string filename = Path.GetFileNameWithoutExtension(entry.Name);

                if (filename.Length > 1) // Only parsing the default templates. Woodland Path, Pink Perfect and Kerning Bunker
                {
                    continue;
                }

                HomeTemplateMetadata homeTemplate = new HomeTemplateMetadata();
                homeTemplate.Cubes = new List<CubeTemplate>();
                homeTemplate.Id = filename;

                XmlNode item = document.SelectSingleNode("ugcmap");
                string[] size = item.Attributes["indoorSizeType"].Value.Split('x');

                homeTemplate.Size = byte.Parse(size[0]);
                homeTemplate.Height = byte.Parse(size[2]);
                sbyte[] baseCoordB = Array.ConvertAll(item.Attributes["baseCubePoint3"].Value.Split(","), sbyte.Parse);
                CoordF baseCoordF = CoordF.From(baseCoordB[0] * Block.BLOCK_SIZE, baseCoordB[1] * Block.BLOCK_SIZE, baseCoordB[2] * Block.BLOCK_SIZE);

                XmlNodeList cubes = document.GetElementsByTagName("cube");
                foreach (XmlNode cube in cubes)
                {
                    int itemId = int.Parse(cube.Attributes["itemID"].Value);

                    byte[] coordsB = Array.ConvertAll(cube.Attributes["offsetCubePoint3"].Value.Split(","), byte.Parse);
                    CoordF cubeCoordF;

                    cubeCoordF = CoordF.From(coordsB[0] * Block.BLOCK_SIZE, coordsB[1] * Block.BLOCK_SIZE, coordsB[2] * Block.BLOCK_SIZE);
                    cubeCoordF.X += baseCoordF.X;
                    cubeCoordF.Y += baseCoordF.Y;

                    int rotation = int.Parse(cube.Attributes["rotation"].Value);
                    CoordF rotationF = CoordF.From(0, 0, rotation);

                    homeTemplate.Cubes.Add(new CubeTemplate(itemId, cubeCoordF, rotationF));
                }

                homeTemplates.Add(homeTemplate);
            }

            return homeTemplates;
        }
コード例 #3
0
        public static Player Char1(long accountId, long characterId, string name = "Char1")
        {
            int job = 50; // Archer

            PlayerStats stats = PlayerStats.Default();

            List <SkillTab> skillTabs = new List <SkillTab>();

            skillTabs.Add(XmlParser.ParseSkills(job));

            Player player = new Player
            {
                SkillTabs   = skillTabs,
                MapId       = 2000062,
                AccountId   = accountId,
                CharacterId = characterId,
                Level       = 70,
                Name        = name,
                Gender      = 1,
                Motto       = "Motto",
                HomeName    = "HomeName",
                Coord       = CoordF.From(2850, 2550, 1800), //Little Harbor
                //Coord = CoordF.From(500, 500, 15000), // tria
                JobGroupId = job,
                SkinColor  = new SkinColor()
                {
                    Primary = Color.Argb(0xFF, 0xEA, 0xBF, 0xAE)
                },
                CreationTime = DateTimeOffset.Now.ToUnixTimeSeconds() + Environment.TickCount,
                Equips       = new Dictionary <ItemSlot, Item> {
                    { ItemSlot.ER, Item.Ear() },
                    { ItemSlot.HR, Item.Hair() },
                    { ItemSlot.FA, Item.Face() },
                    { ItemSlot.FD, Item.FaceDecoration() }
                },
                Stats       = stats,
                GameOptions = new GameOptions(),
                Mesos       = 200000,
                Merets      = 50,
                ValorToken  = 1,
                Treva       = 2,
                Rue         = 3,
                HaviFruit   = 4,
                MesoToken   = 5,
                Inventory   = new Inventory(48),
                Mailbox     = new Mailbox(),
                TitleId     = 10000292,
                InsigniaId  = 29
            };

            player.Equips.Add(ItemSlot.RH, Item.TutorialBow(player));
            return(player);
        }
コード例 #4
0
ファイル: Player.cs プロジェクト: wevvin/MapleServer2
        public static Player Priest(long accountId, long characterId, string name = "Priest")
        {
            Job              job   = Job.Priest;
            PlayerStats      stats = new PlayerStats();
            StatDistribution statPointDistribution = new StatDistribution(totalStats: 18);
            List <SkillTab>  skillTabs             = new List <SkillTab>
            {
                new SkillTab(job)
            };

            Player player = new Player
            {
                SkillTabs             = skillTabs,
                StatPointDistribution = statPointDistribution,
                MapId       = 2000062,
                AccountId   = accountId,
                CharacterId = characterId,
                Name        = name,
                Gender      = 1,
                Motto       = "Motto",
                HomeName    = "HomeName",
                Coord       = CoordF.From(2850, 2550, 1800), // Lith Harbor (2000062)
                // Coord = CoordF.From(500, 500, 15000), // Tria
                Job       = job,
                SkinColor = new SkinColor()
                {
                    Primary = Color.Argb(0xFF, 0xEA, 0xBF, 0xAE)
                },
                CreationTime = DateTimeOffset.Now.ToUnixTimeSeconds() + Environment.TickCount,
                Equips       = new Dictionary <ItemSlot, Item> {
                    { ItemSlot.ER, Item.Ear() },
                    { ItemSlot.HR, Item.Hair() },
                    { ItemSlot.FA, Item.Face() },
                    { ItemSlot.FD, Item.FaceDecoration() }
                },
                Stats       = stats,
                GameOptions = new GameOptions(),
                Mailbox     = new Mailbox(),
                TitleId     = 10000503,
                InsigniaId  = 33,
                Titles      = new List <int> {
                    10000569, 10000152, 10000570, 10000171, 10000196, 10000195, 10000571, 10000331, 10000190,
                    10000458, 10000465, 10000503, 10000512, 10000513, 10000514, 10000537, 10000565, 10000602,
                    10000603, 10000638, 10000644
                },
                IsVIP = false,
            };

            player.Equips.Add(ItemSlot.RH, Item.DefaultScepter(player));
            player.Equips.Add(ItemSlot.LH, Item.DefaultCodex(player));
            return(player);
        }
コード例 #5
0
 public GotoCoordCommand()
 {
     Aliases = new()
     {
         "coord"
     };
     Description = "Get the current coord of the player.";
     Parameters  = new()
     {
         new Parameter <CoordF>("pos", "The position in map.", CoordF.From(0, 0, 0)),
     };
     Usage = "/coord [x], [y], [z]";
 }
コード例 #6
0
    private static CoordF ParseCoordFromString(string input)
    {
        float[] floatArray = Array.ConvertAll(input.Split(","), float.Parse);

        if (floatArray.Length < 3)
        {
            floatArray = new[] {
                floatArray[0], floatArray[1], 0
            };
        }

        return(CoordF.From(floatArray[0], floatArray[1], floatArray[2]));
    }
コード例 #7
0
    private static CoordF ParseCoordFromString(string input)
    {
        float[] floatArray = input.SplitAndParseToFloat(',').ToArray();

        if (floatArray.Length < 3)
        {
            floatArray = new[] {
                floatArray[0], floatArray[1], 0
            };
        }

        return(CoordF.From(floatArray[0], floatArray[1], floatArray[2]));
    }
コード例 #8
0
        public static Player Default(long accountId, long characterId, string name = "SparkmodF")
        {
            int job = 10;

            PlayerStats stats = PlayerStats.Default();

            stats.Hp         = new PlayerStat(1000, 0, 1000);
            stats.CurrentHp  = new PlayerStat(0, 1000, 0);
            stats.Spirit     = new PlayerStat(100, 100, 100);
            stats.Stamina    = new PlayerStat(120, 120, 120);
            stats.AtkSpd     = new PlayerStat(120, 100, 130);
            stats.MoveSpd    = new PlayerStat(110, 100, 150);
            stats.JumpHeight = new PlayerStat(110, 100, 130);

            List <SkillTab> skillTabs = new List <SkillTab>();

            skillTabs.Add(XmlParser.ParseSkills(job));

            Player player = new Player
            {
                SkillTabs   = skillTabs,
                MapId       = 2000062,
                AccountId   = accountId,
                CharacterId = characterId,
                Level       = 70,
                Name        = name,
                Gender      = 1,
                Motto       = "Motto",
                HomeName    = "HomeName",
                Coord       = CoordF.From(2850, 2550, 1800), //Little Harbor
                //Coord = CoordF.From(500, 500, 15000), // tria
                JobGroupId = job,
                SkinColor  = new SkinColor()
                {
                    Primary = Color.Argb(0xFF, 0xEA, 0xBF, 0xAE)
                },
                CreationTime = DateTimeOffset.Now.ToUnixTimeSeconds(),
                Equips       = new Dictionary <ItemSlot, Item> {
                    { ItemSlot.ER, Item.Ear() },
                    { ItemSlot.HR, Item.Hair() },
                    { ItemSlot.FA, Item.Face() },
                    { ItemSlot.FD, Item.FaceDecoration() }
                },
                Stats       = stats,
                GameOptions = new GameOptions(),
                Mesos       = 10,
            };

            player.Equips.Add(ItemSlot.RH, Item.TutorialBow(player));
            return(player);
        }
コード例 #9
0
ファイル: BallCommand.cs プロジェクト: quotopian/MapleServer2
    public override void Execute(GameCommandTrigger trigger)
    {
        Player player = trigger.Session.Player;
        IFieldActor <Player> fieldPlayer  = player.FieldPlayer;
        FieldManager         fieldManager = trigger.Session.FieldManager;

        bool mapIsHome = player.MapId == (int)Map.PrivateResidence;

        if (!mapIsHome)
        {
            return;
        }

        Home home = GameServer.HomeManager.GetHomeById(player.VisitingHomeId);

        if (home.AccountId != player.AccountId)
        {
            return;
        }

        IFieldObject <GuideObject> ballObject = fieldManager.State.Guide.Values.FirstOrDefault(x => x.Value.IsBall);

        if (ballObject is not null)
        {
            fieldManager.RemoveGuide(ballObject);
            fieldManager.BroadcastPacket(HomeActionPacket.RemoveBall(ballObject));
            return;
        }

        int size = trigger.Get <int>("size");

        size = Math.Min(30 + size * 30, 330);
        if (size < 0)
        {
            size = 60;
        }

        GuideObject ball = new(0, player.CharacterId)
        {
            IsBall = true
        };
        IFieldObject <GuideObject> fieldObject = fieldManager.RequestFieldObject(ball);

        fieldObject.Coord    = CoordF.From(fieldPlayer.Coord.X, fieldPlayer.Coord.Y, fieldPlayer.Coord.Z + Block.BLOCK_SIZE * 2);
        fieldObject.Rotation = CoordF.From(0, 0, size);

        fieldManager.AddGuide(fieldObject);

        fieldManager.BroadcastPacket(HomeActionPacket.AddBall(fieldObject));
    }
}
コード例 #10
0
        private static bool TryParseCoord(string s, out CoordF result)
        {
            string[] values = s.Split(",");
            if (values.Length == 3 && float.TryParse(values[0], out float x) &&
                float.TryParse(values[1], out float y) &&
                float.TryParse(values[2], out float z))
            {
                result = CoordF.From(x, y, z);
                return(true);
            }

            result = default;
            return(false);
        }
コード例 #11
0
        public static CoordF ParseCoordFromString(string input)
        {
            float[] floatArray = Array.ConvertAll(input.Split(","), float.Parse);

            if (floatArray.Length < 3)
            {
                float[] tempFloat = new float[3] {
                    floatArray[0], floatArray[1], 0
                };
                floatArray = tempFloat;
            }

            return(CoordF.From(floatArray[0], floatArray[1], floatArray[2]));
        }
コード例 #12
0
        public static List <CoordF> SelectPoints(int spawnRadius = Block.BLOCK_SIZE)
        {
            List <CoordF> spawnOffsets = new List <CoordF>();
            int           spawnSize    = 2 * (spawnRadius / Block.BLOCK_SIZE);

            for (int i = 0; i <= spawnSize; i++)
            {
                for (int j = 0; j <= spawnSize; j++)
                {
                    spawnOffsets.Add(CoordF.From(i * Block.BLOCK_SIZE - spawnRadius, j * Block.BLOCK_SIZE - spawnRadius, 0));
                }
            }
            return(spawnOffsets.OrderBy(x => RandomProvider.Get().Next()).ToList());
        }
コード例 #13
0
        public static bool IsPlayerInBox(MapTriggerBox box, IFieldObject <Player> player)
        {
            CoordF minCoord = CoordF.From(
                box.Position.X - box.Dimension.X / 2,
                box.Position.Y - box.Dimension.Y / 2,
                box.Position.Z - box.Dimension.Z / 2);
            CoordF maxCoord = CoordF.From(
                box.Position.X + box.Dimension.X / 2,
                box.Position.Y + box.Dimension.Y / 2,
                box.Position.Z + box.Dimension.Z / 2);
            bool min = player.Coord.X >= minCoord.X && player.Coord.Y >= minCoord.Y && player.Coord.Z >= minCoord.Z;
            bool max = player.Coord.X <= maxCoord.X && player.Coord.Y <= maxCoord.Y && player.Coord.Z <= maxCoord.Z;

            return(min && max);
        }
コード例 #14
0
 public MobCommand()
 {
     Aliases = new()
     {
         "mob"
     };
     Description = "Spawn a MOB from id.";
     Parameters  = new()
     {
         new Parameter <int>("id", "The id of the MOB.", 21000001),
         new Parameter <short>("ani", "The animation of the MOB.", 1),
         new Parameter <short>("dir", "The rotation of the MOB.", 2700),
         new Parameter <CoordF>("coord", "The position of the MOB.", CoordF.From(0, 0, 0)),
     };
     Usage = "/mob [id] [ani] [dir] [coord]";
 }
コード例 #15
0
 public NpcCommand()
 {
     Aliases = new()
     {
         "npc"
     };
     Description = "Spawn a NPC from id.";
     Parameters  = new()
     {
         new Parameter <int>("id", "The id of the NPC.", 11003146),
         new Parameter <short>("ani", "The animation of the NPC.", 1),
         new Parameter <short>("dir", "The rotation of the NPC.", 2700),
         new Parameter <CoordF>("coord", "The position of the NPC.", CoordF.From(0, 0, 0)),
     };
     Usage = "/npc [id] [ani] [dir] [coord]";
 }
コード例 #16
0
 // Initializes all values to be saved into the database
 public Player(long accountId, string name, byte gender, Job job, SkinColor skinColor)
 {
     AccountId   = accountId;
     Name        = name;
     Gender      = gender;
     Job         = job;
     GameOptions = new GameOptions();
     Wallet      = new Wallet(this, meso: 0, meret: 0, gameMeret: 0, eventMeret: 0, valorToken: 0, treva: 0, rue: 0,
                              haviFruit: 0, mesoToken: 0, bank: 0);
     Levels           = new Levels(this, playerLevel: 1, exp: 0, restExp: 0, prestigeLevel: 1, prestigeExp: 0, new List <MasteryExp>());
     Timestamps       = new TimeInfo(DateTimeOffset.UtcNow.ToUnixTimeSeconds());
     MapId            = 52000065;
     Coord            = CoordF.From(-675, 525, 600); // Intro map (52000065)
     Stats            = new PlayerStats(strBase: 10, dexBase: 10, intBase: 10, lukBase: 10, hpBase: 500, critRateBase: 10);
     Motto            = "Motto";
     ProfileUrl       = "";
     HomeName         = "HomeName";
     CreationTime     = DateTimeOffset.Now.ToUnixTimeSeconds() + Environment.TickCount;
     TitleId          = 0;
     InsigniaId       = 0;
     Titles           = new List <int>();
     ChatSticker      = new List <ChatSticker>();
     FavoriteStickers = new List <int>();
     Emotes           = new List <int>()
     {
         90200011, 90200004, 90200024, 90200041, 90200042, 90200057, 90200043, 90200022, 90200031, 90200005, 90200006, 90200003, 90200092, 90200077, 90200073, 90200023, 90200001, 90200019, 90200020, 90200021
     };
     SkillTabs = new List <SkillTab> {
         new SkillTab(job)
     };
     StatPointDistribution = new StatDistribution(20);
     Inventory             = new Inventory();
     BankInventory         = new BankInventory();
     Mailbox     = new Mailbox();
     BuddyList   = new List <Buddy>();
     QuestList   = new List <QuestStatus>();
     TrophyCount = new int[3] {
         0, 0, 0
     };
     ReturnMapId   = (int)Map.Tria;
     ReturnCoord   = CoordF.From(-900, -900, 3000);
     GroupChatId   = new int[3];
     SkinColor     = skinColor;
     UnlockedTaxis = new List <int>();
     UnlockedMaps  = new List <int>();
     CharacterId   = DatabaseManager.CreateCharacter(this);
 }
コード例 #17
0
        public override void Execute(GameCommandTrigger trigger)
        {
            int   id    = trigger.Get <int>("id");
            short level = trigger.Get <short>("level") > 0 ? trigger.Get <short>("level") : (short)1;

            if (SkillMetadataStorage.GetSkill(id) == null)
            {
                trigger.Session.SendNotice($"Skill with id: {id} is not defined.");
                return;
            }

            SkillCast             skillCast = new SkillCast(id, level, GuidGenerator.Long(), trigger.Session.ServerTick, trigger.Session.FieldPlayer.ObjectId, trigger.Session.ClientTick);
            CoordF                empty     = CoordF.From(0, 0, 0);
            IFieldObject <Player> player    = trigger.Session.FieldPlayer;

            trigger.Session.FieldManager.BroadcastPacket(SkillUsePacket.SkillUse(skillCast, player.Coord, empty, empty));
        }
コード例 #18
0
        public static Player Char2(long accountId, long characterId, string name = "Char2")
        {
            int job = 50;

            PlayerStats stats = PlayerStats.Default();

            List <SkillTab> skillTabs = new List <SkillTab>
            {
                XmlParser.ParseSkills(job)
            };

            return(new Player
            {
                SkillTabs = skillTabs,
                MapId = 2000062,
                AccountId = accountId,
                CharacterId = characterId,
                Level = 70,
                Name = name,
                Gender = 0,
                Motto = "Motto",
                HomeName = "HomeName",
                Coord = CoordF.From(2850, 2550, 1800),
                JobGroupId = job,
                SkinColor = new SkinColor()
                {
                    Primary = Color.Argb(0xFF, 0xEA, 0xBF, 0xAE)
                },
                CreationTime = DateTimeOffset.Now.ToUnixTimeSeconds() + Environment.TickCount,
                Equips = new Dictionary <ItemSlot, Item> {
                    { ItemSlot.ER, Item.EarMale() },
                    { ItemSlot.HR, Item.HairMale() },
                    { ItemSlot.FA, Item.FaceMale() },
                    { ItemSlot.FD, Item.FaceDecorationMale() },
                    { ItemSlot.CL, Item.CloathMale() },
                    { ItemSlot.SH, Item.ShoesMale() },
                },
                Stats = stats,
                GameOptions = new GameOptions(),
                Mesos = 10,
                Inventory = new Inventory(48),
                Mailbox = new Mailbox()
            });
        }
コード例 #19
0
        public static Packet AddBoss(IFieldObject <Mob> mob)
        {
            PacketWriter pWriter = PacketWriter.Of(SendOp.FIELD_ADD_NPC);

            pWriter.WriteInt(mob.ObjectId);
            pWriter.WriteInt(mob.Value.Id);
            pWriter.Write(mob.Coord);
            pWriter.Write(CoordF.From(0, 0, 0));       // Unknown
            pWriter.WriteMapleString(mob.Value.Model); // StrA - kfm model string
            // If NPC is not valid, the packet seems to stop here

            // NPC Stat
            StatPacket.DefaultStatsMob(pWriter, mob);
            // NPC Stat
            pWriter.WriteLong();
            pWriter.WriteLong();
            pWriter.WriteInt();
            pWriter.WriteByte();
            int count = 0;

            pWriter.WriteInt(count); // branch
            for (int i = 0; i < count; i++)
            {
                pWriter.WriteInt();
                pWriter.WriteInt();
                pWriter.WriteInt();
                pWriter.WriteInt();
                pWriter.WriteInt();
                pWriter.WriteInt();
                pWriter.WriteShort();
                pWriter.WriteInt();
                pWriter.WriteByte();
                pWriter.WriteLong();
            }
            // Unknown
            pWriter.WriteLong();
            pWriter.WriteByte();
            pWriter.WriteInt(1);
            pWriter.WriteInt();
            pWriter.WriteByte();

            return(pWriter);
        }
コード例 #20
0
    public override void Execute(GameCommandTrigger trigger)
    {
        int mobId = trigger.Get <int>("id");

        if (NpcMetadataStorage.GetNpcMetadata(mobId) is null)
        {
            trigger.Session.Send(NoticePacket.Notice($"No MOB was found with the id: {mobId.ToString().Color(Color.DarkOliveGreen)}", NoticeType.Chat));
            return;
        }

        CoordF coord = trigger.Get <CoordF>("coord");

        if (coord == default)
        {
            coord = trigger.Session.Player.FieldPlayer.Coord;
        }

        trigger.Session.FieldManager.RequestMob(mobId, coord, CoordF.From(0.0f, 0.0f, trigger.Get <short>("dir")), trigger.Get <short>("ani"));
    }
コード例 #21
0
    public static PacketWriter Sync(SkillCast skillCast, IFieldObject <Player> player, CoordF position, CoordF rotation, bool toggle)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.SKILL_SYNC);

        pWriter.WriteLong(skillCast.SkillSn);
        pWriter.WriteInt(player.ObjectId);
        pWriter.WriteInt(skillCast.SkillId);
        pWriter.WriteShort(skillCast.SkillLevel);
        pWriter.WriteByte();
        pWriter.Write(position);
        pWriter.Write(CoordF.From(0, 0, 0)); // unk
        pWriter.Write(rotation);
        pWriter.Write(CoordF.From(0, 0, 0)); // filler for many 00
        pWriter.WriteBool(toggle);
        pWriter.WriteInt();
        pWriter.WriteByte();

        return(pWriter);
    }
コード例 #22
0
        public static Packet AddMob(IFieldObject <Mob> mob)
        {
            PacketWriter pWriter = PacketWriter.Of(SendOp.FIELD_ADD_NPC);

            pWriter.WriteInt(mob.ObjectId);
            pWriter.WriteInt(mob.Value.Id);
            pWriter.Write(mob.Coord);
            pWriter.Write(CoordF.From(0, 0, 0)); // Rotation
            // If NPC is not valid, the packet seems to stop here

            StatPacket.DefaultStatsMob(pWriter, mob);

            pWriter.WriteLong();
            pWriter.WriteInt();
            pWriter.WriteInt(0x0E); // Unknown
            pWriter.WriteInt();
            pWriter.WriteByte();

            return(pWriter);
        }
コード例 #23
0
        public static Player Char2(long accountId, long characterId, string name = "Char2")
        {
            Job         job   = Job.Archer;
            PlayerStats stats = new PlayerStats();

            int             mapId     = (int)Map.Queenstown;
            MapPlayerSpawn  spawn     = MapEntityStorage.GetRandomPlayerSpawn(mapId);
            List <SkillTab> skillTabs = new List <SkillTab>
            {
                new SkillTab(job)
            };

            return(new Player
            {
                SkillTabs = skillTabs,
                MapId = mapId,
                AccountId = accountId,
                CharacterId = characterId,
                Name = name,
                Gender = 0,
                Motto = "Motto",
                HomeName = "HomeName",
                Coord = CoordF.From(spawn.Coord.X, spawn.Coord.Y, spawn.Coord.Z),
                Job = job,
                SkinColor = new SkinColor()
                {
                    Primary = Color.Argb(0xFF, 0xEA, 0xBF, 0xAE)
                },
                CreationTime = DateTimeOffset.Now.ToUnixTimeSeconds() + Environment.TickCount,
                Equips = new Dictionary <ItemSlot, Item> {
                    { ItemSlot.ER, Item.EarMale() },
                    { ItemSlot.HR, Item.HairMale() },
                    { ItemSlot.FA, Item.FaceMale() },
                    { ItemSlot.FD, Item.FaceDecorationMale() },
                    { ItemSlot.CL, Item.CloathMale() },
                    { ItemSlot.SH, Item.ShoesMale() },
                },
                Stats = stats
            });
        }
コード例 #24
0
ファイル: FieldPacket.cs プロジェクト: rhydev/MapleServer2
        public static Packet AddNpc(IFieldObject <Npc> npc)
        {
            PacketWriter pWriter = PacketWriter.Of(SendOp.FIELD_ADD_NPC)
                                   .WriteInt(npc.ObjectId)
                                   .WriteInt(npc.Value.Id)
                                   .Write(npc.Coord)
                                   .Write(CoordF.From(0, 0, 0)); // Unknown

            // If NPC is not valid, the packet seems to stop here

            // NPC Stat
            StatPacket.DefaultStatsNpc(pWriter);
            // NPC Stat

            pWriter.WriteByte();
            short count = 0;

            pWriter.WriteShort(count); // branch
            for (int i = 0; i < count; i++)
            {
                pWriter.WriteInt()
                .WriteInt()
                .WriteInt()
                .WriteInt()
                .WriteInt()
                .WriteInt()
                .WriteShort()
                .WriteInt()
                .WriteByte()
                .WriteLong();
            }

            pWriter.WriteLong() // uid
            .WriteByte()
            .WriteInt(1)
            .WriteInt()
            .WriteByte();

            return(pWriter);
        }
コード例 #25
0
        public static Player NewCharacter(byte gender, /*Job jobType*/ int job, string name, SkinColor skinColor, object equips)
        {
            PlayerStats stats = PlayerStats.Default();

            stats.Hp         = new PlayerStat(1000, 0, 1000);
            stats.CurrentHp  = new PlayerStat(0, 1000, 0);
            stats.Spirit     = new PlayerStat(100, 100, 100);
            stats.Stamina    = new PlayerStat(120, 120, 120);
            stats.AtkSpd     = new PlayerStat(120, 100, 130);
            stats.MoveSpd    = new PlayerStat(110, 100, 150);
            stats.JumpHeight = new PlayerStat(110, 100, 130);

            List <SkillTab> skillTabs = new List <SkillTab>();

            skillTabs.Add(XmlParser.ParseSkills(job));

            return(new Player
            {
                SkillTabs = skillTabs,
                AccountId = 0x1111111111111111,
                CharacterId = BitConverter.ToInt64(Guid.NewGuid().ToByteArray(), 0),
                CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
                Name = name,
                Gender = gender,
                //jobType = jobType,
                JobGroupId = job,
                Level = 1,
                MapId = 2000062,
                Stats = stats,
                SkinColor = skinColor,
                Equips = (Dictionary <ItemSlot, Item>)equips,
                Motto = "Motto",
                HomeName = "HomeName",
                Coord = CoordF.From(2850, 2550, 1800),
                GameOptions = new GameOptions(),
                Mesos = 10,
            });
        }
コード例 #26
0
ファイル: Player.cs プロジェクト: albesal99/MapleServer2
        public static Player Char2(long accountId, long characterId, string name = "Char2")
        {
            Job         job   = Job.Archer;
            PlayerStats stats = PlayerStats.Default();

            List <SkillTab> skillTabs = new List <SkillTab>
            {
                new SkillTab(job)
            };

            return(new Player
            {
                SkillTabs = skillTabs,
                MapId = 2000062,
                AccountId = accountId,
                CharacterId = characterId,
                Name = name,
                Gender = 0,
                Motto = "Motto",
                HomeName = "HomeName",
                Coord = CoordF.From(2850, 2550, 1800),
                Job = job,
                SkinColor = new SkinColor()
                {
                    Primary = Color.Argb(0xFF, 0xEA, 0xBF, 0xAE)
                },
                CreationTime = DateTimeOffset.Now.ToUnixTimeSeconds() + Environment.TickCount,
                Equips = new Dictionary <ItemSlot, Item> {
                    { ItemSlot.ER, Item.EarMale() },
                    { ItemSlot.HR, Item.HairMale() },
                    { ItemSlot.FA, Item.FaceMale() },
                    { ItemSlot.FD, Item.FaceDecorationMale() },
                    { ItemSlot.CL, Item.CloathMale() },
                    { ItemSlot.SH, Item.ShoesMale() },
                },
                Stats = stats
            });
        }
コード例 #27
0
ファイル: Mob.cs プロジェクト: quotopian/MapleServer2
        public void Move(MobMovement moveType)
        {
            Random rand = RandomProvider.Get();

            switch (moveType)
            {
            case MobMovement.Patrol:
                // Fallback Dummy Movement
                int   moveDistance = rand.Next(0, Value.MoveRange);
                short moveDir      = (short)rand.Next(-1800, 1800);

                Velocity = CoordF.From(moveDistance, moveDir);
                // Keep near spawn
                if ((SpawnDistance - Velocity).Length() >= Block.BLOCK_SIZE * 2)
                {
                    moveDir  = (short)SpawnDistance.XYAngle();
                    Velocity = CoordF.From(Block.BLOCK_SIZE, moveDir);
                }

                LookDirection = moveDir;     // looking direction of the monster
                break;

            case MobMovement.Follow:     // move towards target
                Velocity = CoordF.From(0, 0, 0);
                break;

            case MobMovement.Strafe:  // move around target
            case MobMovement.Run:     // move away from target
            case MobMovement.LookAt:
            case MobMovement.Hold:
            default:
                Velocity = CoordF.From(0, 0, 0);
                break;
            }

            SpawnDistance -= Velocity;
        }
コード例 #28
0
ファイル: Player.cs プロジェクト: 67-6f-64/MapleServer2
        public static Player Default(long accountId, long characterId, int mapId, string name = "Default")
        {
            PlayerStats stats = PlayerStats.Default();

            stats.Hp         = new PlayerStat(1000, 0, 1000);
            stats.CurrentHp  = new PlayerStat(0, 1000, 0);
            stats.Spirit     = new PlayerStat(100, 100, 100);
            stats.Stamina    = new PlayerStat(120, 120, 120);
            stats.AtkSpd     = new PlayerStat(120, 100, 130);
            stats.MoveSpd    = new PlayerStat(110, 100, 150);
            stats.JumpHeight = new PlayerStat(110, 100, 130);

            return(new Player
            {
                MapId = mapId,//2000062,
                AccountId = accountId,
                CharacterId = characterId,
                Level = 80,
                Name = name,
                Gender = 1,
                Motto = "Motto",
                HomeName = "HomeName",
                Coord = CoordF.From(2850, 2550, 1800),
                JobGroupId = 50,
                SkinColor = new SkinColor()
                {
                    Primary = Color.Argb(0xFF, 0xEA, 0xBF, 0xAE)
                },
                CreationTime = DateTimeOffset.Now.ToUnixTimeSeconds(),
                Equip = new Dictionary <EquipSlot, Item> {
                },
                Stats = stats,
                GameOptions = new GameOptions(),
                Mesos = 10,
            });
        }
コード例 #29
0
ファイル: FieldPacket.cs プロジェクト: swoonning/MapleServer2
        public static Packet AddNpc(IFieldObject <Npc> npc)
        {
            PacketWriter pWriter = PacketWriter.Of(SendOp.FIELD_ADD_NPC)
                                   .WriteInt(npc.ObjectId)
                                   .WriteInt(npc.Value.Id)
                                   .Write(npc.Coord)
                                   .Write(CoordF.From(0, 0, 0)); // Unknown
            // If NPC is not valid, the packet seems to stop here

            // NPC Stat
            byte flag = 0x23;

            pWriter.WriteByte(flag);
            if (flag == 1)
            {
                byte value = 0;
                pWriter.WriteByte(value); // value
                if (value == 4)
                {
                    pWriter.WriteLong()
                    .WriteLong()
                    .WriteLong();
                }
                else
                {
                    pWriter.WriteInt()
                    .WriteInt()
                    .WriteInt();
                }
            }
            else
            {
                pWriter.WriteLong(29)
                .WriteInt()
                .WriteLong(29)
                .WriteInt()
                .WriteLong(29)
                .WriteInt();
            }
            // NPC Stat

            pWriter.WriteByte();

            short count = 0;

            pWriter.WriteShort(count); // branch
            for (int i = 0; i < count; i++)
            {
                pWriter.WriteInt()
                .WriteInt()
                .WriteInt()
                .WriteInt()
                .WriteInt()
                .WriteInt()
                .WriteShort()
                .WriteInt()
                .WriteByte()
                .WriteLong();
            }

            pWriter.WriteLong() // uid
            .WriteByte()
            .WriteInt(1)
            .WriteInt()
            .WriteByte();

            return(pWriter);
        }
コード例 #30
0
ファイル: Coord.cs プロジェクト: Zintixx/MapleServer2
 public readonly CoordF ToFloat()
 {
     return(CoordF.From(X, Y, Z));
 }