Beispiel #1
0
 internal void LoadAbsToDictionary()
 {
     if (CharacterItemInGame.Instance._listTextAssetAbnormal.Count > 0)
     {
         for (int i = 0; i < CharacterItemInGame.Instance._listTextAssetAbnormal.Count; i++)
         {
             string text = CharacterItemInGame.Instance._listTextAssetAbnormal[i].ToString();
             text = text.Replace("\r\n", "");
             int            idAbs = CoreLib.JSONNode.Parse(text)["idInit"];
             AbnormalStatus Abs   = new AbnormalStatus(CoreLib.JSONNode.Parse(text));
             Abs.addField("nick", "AS" + idAbs);
             SplitDataFromServe.absInit.Add("AS" + idAbs, Abs);
             SplitDataFromServe._heroAbs.Add(Abs);
         }
     }
     Adapter.abs = SplitDataFromServe.absInit;
     LoadEquippedData();
 }
Beispiel #2
0
        public NewEffect parseString(string base64string) // Convert ra NewEffect chua ket noi voi cac Status
        {
            NewEffect effect = null;

            byte[] bytes = Convert.FromBase64String(base64string);
            bytes = Utilities.SubArray <byte>(bytes, 1, bytes.Length - 1);            // loai bo byte file do dai day byte


            int byte_shift = 0;
            int sub        = 0;

            byte[] part = Utilities.SubArray <byte>(bytes, byte_shift, sizeof(ushort));
            ushort type = BitConverter.ToUInt16(part, 0);

            byte_shift += sizeof(ushort);

            part        = Utilities.SubArray <byte>(bytes, byte_shift, sizeof(byte));
            byte_shift += sizeof(byte);
            int originID = part[0];

            string name = "";
            string nick = "";

            part        = Utilities.SubArray <byte>(bytes, byte_shift, sizeof(byte));
            byte_shift += sizeof(byte);
            int playerID = part[0];

            if (type < 1000)             // SKill
            {
                NewSkill skill = Adapter.skills["Skill" + type];
                nick = "Skill" + type;
                name = skill.data["name"].Value;
                // doc tiep
                part        = Utilities.SubArray <byte>(bytes, byte_shift, sizeof(byte));
                byte_shift += sizeof(byte);
                int level = (sbyte)part[0];
                // duration
                part        = Utilities.SubArray <byte>(bytes, byte_shift, sizeof(byte));
                byte_shift += sizeof(byte);
                int duration = (sbyte)part[0];
                // doc tiep cac atomic

                string condition = skill.data["condition"] == null ? "" : skill.data["condition"].Value;
                effect = new NewEffect(originID, name, nick, level, duration, condition);

                JSONNode data = skill.data;

                JSONArray lines = (JSONArray)data["lines"];

                foreach (JSONObject line in lines)
                {
                    part        = Utilities.SubArray <byte>(bytes, byte_shift, sizeof(byte));
                    byte_shift += sizeof(byte);
                    duration    = (sbyte)part[0];

                    string       delta  = line["delta"].Value;
                    string       index  = line["index"].Value;
                    string       con    = line["condition"] == null ? "" : line["condition"].Value;
                    bool         enemy  = line["enemy"] == null ? false : Convert.ToBoolean(line["enemy"].Value);
                    AtomicEffect atomic = new AtomicEffect(effect, delta, index, enemy, con, duration);
                    effect.atomicEffects.Add(atomic);
                }

                effect.playerID = playerID;
            }
            else if (type < 2000)             // AS
            {
                sub = type - 1000;
                AbnormalStatus ab = Adapter.abs["AS" + type];
                nick = "AS" + type;
                name = ab.data["name"].Value;

                part        = Utilities.SubArray <byte>(bytes, byte_shift, sizeof(byte));
                byte_shift += sizeof(byte);
                int duration = (sbyte)part[0];
                effect = new NewEffect(originID, name, nick, -1, duration);
                JSONNode data = ab.data;

                JSONArray lines = data["line"] != null ? (JSONArray)data["lines"] : null;
                if (lines != null)
                {
                    foreach (JSONObject line in lines)
                    {
                        part        = Utilities.SubArray <byte>(bytes, byte_shift, sizeof(byte));
                        byte_shift += sizeof(byte);
                        duration    = (sbyte)part[0];
                        string       delta  = line["delta"].Value;
                        string       index  = line["index"].Value;
                        string       con    = line["condition"] == null ? "" : line["condition"].Value;
                        bool         enemy  = true;
                        AtomicEffect atomic = new AtomicEffect(effect, delta, index, enemy, con, duration);
                        effect.atomicEffects.Add(atomic);
                    }
                }
                switch (name)
                {
                case Burn:
                    part = Utilities.SubArray <byte>(bytes, byte_shift, bytes.Length - byte_shift);
                    effect.indexes.Add("burn_damage", BitConverter.ToInt32(part, 0));
                    break;

                case Poisoning:
                    part = Utilities.SubArray <byte>(bytes, byte_shift, bytes.Length - byte_shift);
                    effect.indexes.Add("poison_damage", BitConverter.ToInt32(part, 0));
                    break;
                }

                effect.playerID = playerID;
            }
            else
            {
                sub = type - 2000;
                switch (sub)
                {
                case 1:
                    effect = new NewEffect(originID, "HealthChanges");
                    break;

                case 2:
                    effect = new NewEffect(originID, "Blocking");

                    break;

                case 3:
                    effect = new NewEffect(originID, "Dodge");

                    break;

                case 4:
                    effect = new NewEffect(originID, "Critical");

                    break;

                case 5:
                    effect = new NewEffect(originID, "ReturnDamage");
                    break;

                case 6:
                    effect = new NewEffect(originID, "Multicast");
                    break;

                case 7:
                    effect = new NewEffect(originID, "RemoveAllAbnormal");
                    break;

                case 8:
                    effect = new NewEffect(originID, "DoubleMagic");
                    break;

                case 9:
                    effect = new NewEffect(originID, "HealthRecovery");
                    break;

                case 10:
                    effect = new NewEffect(originID, "HealthRecovery_Glamour");
                    break;

                default:
                    if (sub < 4000)
                    {    // HealthAdd_Skill
                        effect = new NewEffect(originID, "HealthAdd_Skill" + (sub - 3000));
                    }
                    else if (sub < 5000)
                    {    // HealthAdd_Glamour_Skill
                        effect = new NewEffect(originID, "HealthAdd_Glamour_Skill" + (sub - 4000));
                    }
                    else if (sub < 6000)
                    {
                        effect = new NewEffect(originID, "HealthSub_Skill" + (sub - 5000));
                    }
                    break;
                }
                effect.playerID = playerID;
            }


            return(effect);
        }