Exemplo n.º 1
0
        // 4 头像模型名称性别替换
        public static void ReplacePlayerExteriorData()
        {
            string[] characters = new string[] { GameConfig.Player, "in0196", "in0197", "in0101", "in0115" };
            for (int i = 0; i < characters.Length; i++)
            {
                CharacterExteriorData playerExteriorData = Game.GameData.Exterior[characters[i]];
                if (playerExteriorData != null && newGameExteriorId.Value.Trim() != string.Empty)
                {
                    CharacterExterior characterExterior = Game.Data.Get <CharacterExterior>(newGameExteriorId.Value.Trim());
                    if (characterExterior != null)
                    {
                        //CharacterExterior exterior = Game.Data.Get<CharacterExterior>(playerExteriorData.Id);
                        playerExteriorData.Id       = characterExterior.Id;
                        playerExteriorData.Model    = characterExterior.Model;
                        playerExteriorData.Gender   = characterExterior.Gender;
                        playerExteriorData.Size     = characterExterior.Size;
                        playerExteriorData.Protrait = characterExterior.Protrait;
                    }
                }
                if (!newGamePortraitOverride.Value.Trim().IsNullOrEmpty())
                {
                    CharacterExterior characterExterior = Game.Data.Get <CharacterExterior>(newGamePortraitOverride.Value.Trim());
                    playerExteriorData.Protrait = characterExterior.Protrait;
                }

                if (!newGameSurNameOverride.Value.Trim().IsNullOrEmpty())
                {
                    playerExteriorData.SurName = newGameSurNameOverride.Value.Trim();
                }
                if (!newGameNameOverride.Value.Trim().IsNullOrEmpty())
                {
                    playerExteriorData.Name = newGameNameOverride.Value.Trim();
                }
            }
        }
Exemplo n.º 2
0
 public static bool FixPartyCount3(Party __instance, ref CharacterExteriorData[] __result)
 {
     CharacterExteriorData[] array = new CharacterExteriorData[teamMemberMax.Value];
     for (int i = 1; i < array.Length; i++)
     {
         string partyByIndex = __instance.GetPartyByIndex(i);
         if (!partyByIndex.IsNullOrEmpty())
         {
             array[i] = Game.GameData.Exterior[partyByIndex];
         }
     }
     __result = array;
     return(false);
 }
Exemplo n.º 3
0
        public override bool GetValue()
        {
            if (Application.isPlaying)
            {
                string                fromId = GlobalLib.ReplaceText(fromInfoId);
                string                toId   = GlobalLib.ReplaceText(toInfoId);
                CharacterInfoData     from   = Game.GameData.Character[fromId];
                CharacterInfoData     to     = Game.GameData.Character[toId];
                CharacterExteriorData toEx   = Game.GameData.Exterior[toId];
                if (from == null || to == null || toEx == null || from == to)
                {
                    return(false);
                }

                float totalDelta = 0;
                for (int i = 0; i < propertyTypes.Length; ++i)
                {
                    var propertyType = propertyTypes[i];
                    totalDelta += from.GetUpgradeableProperty(propertyType) - to.GetUpgradeableProperty(propertyType);
                }
                float scale = scalar * (2f - totalDelta / 2000f);

                List <string> list = new List <string>();
                for (int i = 0; i < propertyTypes.Length; ++i)
                {
                    var propertyType = propertyTypes[i];
                    int delta        = from.GetUpgradeableProperty(propertyType) - to.GetUpgradeableProperty(propertyType) + baseValue;
                    int exp          = (int)Mathf.Max(0f, delta * scale);
                    if (exp >= 100)
                    {
                        to.AddUpgradeablePropertyExp(propertyType, exp);
                        to.UpgradeProperty(false);
                        list.Add(string.Format("{0}提升{1}", Game.Data.Get <StringTable>(messages[i]).Text, exp / 100));
                    }
                }
                if (list.Count > 0)
                {
                    Game.UI.AddMessage(string.Format("{0}经切磋,{1}", toEx.FullName(), string.Join(",", list)), UIPromptMessage.PromptType.Normal);
                }
                else
                {
                    Game.UI.AddMessage(string.Format("{0}由于四维超出对手过多,切磋后未获提升", toEx.FullName()), UIPromptMessage.PromptType.Normal);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        // 4 头像模型替换
        public static void ReplacePlayerExteriorData()
        {
            CharacterExteriorData playerExteriorData = Game.GameData.Exterior[GameConfig.Player];

            if (playerExteriorData != null && newGameExteriorId.Value != string.Empty)
            {
                CharacterExterior characterExterior = Game.Data.Get <CharacterExterior>(newGameExteriorId.Value);
                if (characterExterior != null)
                {
                    CharacterExterior exterior = Game.Data.Get <CharacterExterior>(playerExteriorData.Id);
                    playerExteriorData.Id       = exterior.Id = characterExterior.Id;
                    playerExteriorData.Model    = exterior.Model = characterExterior.Model;
                    playerExteriorData.Gender   = exterior.Gender = characterExterior.Gender;
                    playerExteriorData.Size     = exterior.Size = characterExterior.Size;
                    playerExteriorData.Protrait = exterior.Protrait = newGamePortraitOverride.Value.IsNullOrEmpty() ? characterExterior.Protrait : newGamePortraitOverride.Value;
                }
            }
        }
Exemplo n.º 5
0
        public static bool CtrlTeamMemberFix_UpdateProperty(CtrlTeamMember __instance, List <CharacterMapping> characterMapping)
        {
            List <PartyInfo> list = new List <PartyInfo>();

            foreach (CharacterMapping characterMapping2 in characterMapping)
            {
                CharacterInfoData     characterInfoData     = Game.GameData.Character[characterMapping2.InfoId];
                CharacterExteriorData characterExteriorData = Game.GameData.Exterior[characterMapping2.ExteriorId];
                list.Add(new PartyInfo
                {
                    Protrait = characterExteriorData.Protrait,
                    Element  = characterInfoData.Element,
                    FullName = characterExteriorData.SurName + characterExteriorData.Name,
                    Hp       = (float)characterInfoData.Property[CharacterProperty.HP].Value,
                    MaxHp    = (float)characterInfoData.Property[CharacterProperty.Max_HP].Value,
                    Mp       = (float)characterInfoData.Property[CharacterProperty.MP].Value,
                    MaxMp    = (float)characterInfoData.Property[CharacterProperty.Max_MP].Value
                });
            }
            Traverse.Create(__instance).Field("view").GetValue <UITeamMember>().UpdateProperty(list);
            return(false);
        }
Exemplo n.º 6
0
        static List <PartyInfo> GetPartyInfo()
        {
            List <CharacterMapping> list = new List <CharacterMapping>();

            foreach (string text in Game.GameData.Party)
            {
                CharacterMapping characterMapping = new CharacterMapping();
                if (text == GameConfig.Player)
                {
                    characterMapping.Id = (characterMapping.InfoId = (characterMapping.ExteriorId = text));
                }
                else
                {
                    Npc npc = Game.Data.Get <Npc>(text);
                    if (npc == null)
                    {
                        Console.WriteLine("找不到ID: " + text + "的的NPC, 請檢查Npc.txt");
                        continue;
                    }
                    characterMapping.Id         = text;
                    characterMapping.InfoId     = npc.CharacterInfoId;
                    characterMapping.ExteriorId = npc.ExteriorId;
                }
                list.Add(characterMapping);
            }
            List <PartyInfo> result = new List <PartyInfo>();

            foreach (CharacterMapping characterMapping2 in list)
            {
                CharacterInfoData     characterInfoData     = Game.GameData.Character[characterMapping2.InfoId];
                CharacterExteriorData characterExteriorData = Game.GameData.Exterior[characterMapping2.InfoId];
                result.Add(new PartyInfo
                {
                    Protrait = characterExteriorData.Protrait,
                    Element  = characterInfoData.Element,
                });
            }
            return(result);
        }
Exemplo n.º 7
0
        private static bool AddLuaParams(Script script, T item)
        {
            if (!UserData.IsTypeRegistered(typeof(T)))
            {
                UserData.RegisterType(typeof(T));
            }
            if (item.GetType() != typeof(Npc))
            {
                script.Globals["item"] = item;
            }
            else
            {
                // 传NPC信息没太大用处,改传CharacterInfo的信息
                Npc npc = item as Npc;
                try
                {
                    CharacterExteriorData exterior = null;
                    CharacterInfoData     info     = null;
                    if (!npc.ExteriorId.IsNullOrEmpty())
                    {
                        exterior = Game.GameData.Exterior[npc.ExteriorId];
                    }
                    if (exterior != null && !exterior.InfoId.IsNullOrEmpty())
                    {
                        info = Game.GameData.Character[exterior.InfoId];
                    }
                    else if (!npc.CharacterInfoId.IsNullOrEmpty())
                    {
                        info = Game.GameData.Character[npc.CharacterInfoId];
                    }

                    if (info == null || info.Id.IsNullOrEmpty())
                    {
                        return(false);
                    }
                    if (info.Property[CharacterProperty.Max_HP].Value <= 0)
                    {
                        return(false);
                    }

                    if (!UserData.IsTypeRegistered <CharacterInfoData>())
                    {
                        UserData.RegisterType <CharacterInfoData>(InteropAccessMode.Default, null);
                    }
                    script.Globals["item"] = info;

                    foreach (object obj in Enum.GetValues(typeof(CharacterUpgradableProperty)))
                    {
                        CharacterUpgradableProperty prop = (CharacterUpgradableProperty)obj;
                        int value = info.GetUpgradeableProperty(prop);
                        script.Globals[obj.ToString().ToLower()] = value;
                    }
                    foreach (object obj2 in Enum.GetValues(typeof(CharacterProperty)))
                    {
                        CharacterProperty prop2 = (CharacterProperty)obj2;
                        int value2 = info.Property[prop2].Value;
                        script.Globals[obj2.ToString().ToLower()] = value2;
                    }
                }
                catch
                {
                    Console.WriteLine(string.Format("NPC信息出错 npc={0}, exId={1}, infoId={2}", npc.Id, npc.ExteriorId, npc.CharacterInfoId));
                    return(false);
                }
            }
            return(true);
        }