コード例 #1
0
        public static void SaveExPlayer(exPlayer player, XmlWriter writer)
        {
            writer.WriteStartElement("ElectrostasisTower");

            writer.WriteElementString("ElectrolockCharge", player.ElectrolockCharge.ToString());
            writer.WriteElementString("ElectrolockLevel", player.ElectrolockLevel.ToString());

            writer.WriteStartElement("ElectrolockSublevels");
            for (int i = 0; i < player.ElectrolockSublevel.Count; i++)
            {
                writer.WriteElementString("ID", player.ElectrolockSublevel[i].ToString());
            }
            writer.WriteEndElement();

            writer.WriteStartElement("ElectrolockSublevelTriggersActive");
            for (int i = 0; i < player.ElectrolockSublevelTriggersActive.Count; i++)
            {
                writer.WriteElementString("ID", player.ElectrolockSublevelTriggersActive[i].ToString());
            }
            writer.WriteEndElement();

            writer.WriteStartElement("ElectrolockSublevelTriggersActive");
            for (int i = 0; i < player.ElectrolockSublevelTriggersActive.Count; i++)
            {
                writer.WriteElementString("ID", player.ElectrolockSublevelTriggersActive[i].ToString());
            }
            writer.WriteEndElement();

            writer.WriteEndElement();
        }
コード例 #2
0
        public static bool VerifyKeyTile(Client client, IMap map, int x, int y, PacketHitList packetList)
        {
            PacketHitList.MethodStart(ref packetList);
            bool unlocked = false;

            Tile mapTile = map.Tile[x, y];

            if (mapTile.Type == Server.Enums.TileType.Scripted)
            {
                if (mapTile.Data1 == 58)
                {
                    int      chargeLevel = mapTile.String1.ToInt();
                    exPlayer exPlayer    = exPlayer.Get(client);

                    if ((exPlayer.ElectrolockLevel == chargeLevel && exPlayer.ElectrolockCharge >= ChargesNeededForLevel(chargeLevel) && exPlayer.ElectrolockSublevel.Count >= SublevelsNeededForLevel(chargeLevel)) ||
                        exPlayer.ElectrolockLevel > chargeLevel)
                    {
                        unlocked = true;
                        DisplayInvisibleKeyTile(client, map, x, y, packetList);
                    }
                    else
                    {
                        DisplayVisibleKeyTile(client, map, x, y, packetList);
                    }
                }
            }
            PacketHitList.MethodEnded(ref packetList);
            return(unlocked);
        }
コード例 #3
0
ファイル: exPlayer.cs プロジェクト: MystikalPooka/PJOFiles
        public static exPlayer Get(Client client)
        {
            exPlayer exPlayer = client.Player.ExPlayer as exPlayer;

            if (exPlayer == null)
            {
                client.Player.ExPlayer = new exPlayer(client);
                exPlayer = client.Player.ExPlayer as exPlayer;
                exPlayer.Load();
            }
            return(exPlayer);
        }
コード例 #4
0
        public static void VerifySublevelTriggerTile(Client client, IMap map, int x, int y, PacketHitList packetList)
        {
            PacketHitList.MethodStart(ref packetList);

            Tile mapTile = map.Tile[x, y];

            if (mapTile.Type == Server.Enums.TileType.Scripted)
            {
                if (mapTile.Data1 == 59)
                {
                    string   triggerID = mapTile.String1;
                    exPlayer exPlayer  = exPlayer.Get(client);
                    if (exPlayer.ElectrolockSublevelTriggersActive.Contains(triggerID) == false)
                    {
                        DisplayVisibleSublevelTriggerTile(client, map, x, y, packetList);
                    }
                    else
                    {
                        DisplayInvisibleSublevelTriggerTile(client, map, x, y, packetList);
                    }
                }
            }
            PacketHitList.MethodEnded(ref packetList);
        }
コード例 #5
0
        public static void LoadExPlayer(exPlayer player, XmlReader reader)
        {
            player.ElectrolockSublevel = new List <int>();

            player.ElectrolockSublevelTriggersActive = new List <string>();
            using (reader) {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                        case "ElectrolockCharge": {
                            player.ElectrolockCharge = reader.ReadString().ToInt();
                        }
                        break;

                        case "ElectrolockLevel": {
                            player.ElectrolockLevel = reader.ReadString().ToInt();
                        }
                        break;

                        case "ElectrolockSublevels": {
                            player.ElectrolockSublevel.Clear();
                            using (XmlReader subReader = reader.ReadSubtree()) {
                                while (subReader.Read())
                                {
                                    if (subReader.IsStartElement())
                                    {
                                        switch (subReader.Name)
                                        {
                                        case "ID": {
                                            player.ElectrolockSublevel.Add(subReader.ReadString().ToInt());
                                        }
                                        break;
                                        }
                                    }
                                }
                            }
                        }
                        break;

                        case "ElectrolockSublevelTriggersActive": {
                            player.ElectrolockSublevelTriggersActive.Clear();
                            using (XmlReader subReader = reader.ReadSubtree()) {
                                while (subReader.Read())
                                {
                                    if (subReader.IsStartElement())
                                    {
                                        switch (subReader.Name)
                                        {
                                        case "ID": {
                                            player.ElectrolockSublevelTriggersActive.Add(subReader.ReadString());
                                        }
                                        break;
                                        }
                                    }
                                }
                            }
                        }
                        break;
                        }
                    }
                }
            }
        }
コード例 #6
0
ファイル: ElectrostasisTower.cs プロジェクト: pzaps/Server
        public static void SaveExPlayer(exPlayer player, XmlWriter writer)
        {
            writer.WriteStartElement("ElectrostasisTower");

            writer.WriteElementString("ElectrolockCharge", player.ElectrolockCharge.ToString());
            writer.WriteElementString("ElectrolockLevel", player.ElectrolockLevel.ToString());

            writer.WriteStartElement("ElectrolockSublevels");
            for (int i = 0; i < player.ElectrolockSublevel.Count; i++) {
                writer.WriteElementString("ID", player.ElectrolockSublevel[i].ToString());
            }
            writer.WriteEndElement();

            writer.WriteStartElement("ElectrolockSublevelTriggersActive");
            for (int i = 0; i < player.ElectrolockSublevelTriggersActive.Count; i++) {
                writer.WriteElementString("ID", player.ElectrolockSublevelTriggersActive[i].ToString());
            }
            writer.WriteEndElement();

            writer.WriteStartElement("ElectrolockSublevelTriggersActive");
            for (int i = 0; i < player.ElectrolockSublevelTriggersActive.Count; i++) {
                writer.WriteElementString("ID", player.ElectrolockSublevelTriggersActive[i].ToString());
            }
            writer.WriteEndElement();

            writer.WriteEndElement();
        }
コード例 #7
0
ファイル: ElectrostasisTower.cs プロジェクト: pzaps/Server
        public static void LoadExPlayer(exPlayer player, XmlReader reader)
        {
            player.ElectrolockSublevel = new List<int>();

            player.ElectrolockSublevelTriggersActive = new List<string>();
            using (reader) {
                while (reader.Read()) {
                    if (reader.IsStartElement()) {
                        switch (reader.Name) {
                            case "ElectrolockCharge": {

                                    player.ElectrolockCharge = reader.ReadString().ToInt();
                                }
                                break;
                            case "ElectrolockLevel": {
                                    player.ElectrolockLevel = reader.ReadString().ToInt();
                                }
                                break;
                            case "ElectrolockSublevels": {
                                    player.ElectrolockSublevel.Clear();
                                    using (XmlReader subReader = reader.ReadSubtree()) {
                                        while (subReader.Read()) {
                                            if (subReader.IsStartElement()) {
                                                switch (subReader.Name) {
                                                    case "ID": {
                                                            player.ElectrolockSublevel.Add(subReader.ReadString().ToInt());
                                                        }
                                                        break;
                                                }
                                            }
                                        }
                                    }
                                }
                                break;

                            case "ElectrolockSublevelTriggersActive": {
                                    player.ElectrolockSublevelTriggersActive.Clear();
                                    using (XmlReader subReader = reader.ReadSubtree()) {
                                        while (subReader.Read()) {
                                            if (subReader.IsStartElement()) {
                                                switch (subReader.Name) {
                                                    case "ID": {
                                                            player.ElectrolockSublevelTriggersActive.Add(subReader.ReadString());
                                                        }
                                                        break;
                                                }
                                            }
                                        }
                                    }
                                }
                                break;

                        }
                    }
                }
            }
        }