コード例 #1
0
        private void Init()
        {
            var path    = BasePath.Name;
            var nowpath = AssemblyDirectory;
            var paths   = nowpath.Split('\\');

            NowModName   = paths[paths.Length - 3];
            NowModNameId = NowModName.ToLower();

            var filePath = BasePath.Name + @"Modules\" + NowModName + @"\MBLog.txt";

            LPLog.LogPath = filePath;

            LPLog.Log("当前mod名:" + NowModName);
        }
コード例 #2
0
        public override bool DoLoading(Game game)
        {
            Init();

            try
            {
                if (MobileParty.MainParty == null || MobileParty.MainParty.ItemRoster == null || Hero.MainHero == null)
                {
                    InformationManager.DisplayMessage(new InformationMessage("未获取玩家信息,请存档后重新读取。", new Color(.65f, .35f, 0)));
                    return(true);
                }

                var items = new List <ItemObject>();

                for (int i = 0; i < MobileParty.MainParty.ItemRoster.Count; i++)
                {
                    items.Add(MobileParty.MainParty.ItemRoster.GetItemAtIndex(i));
                }

                for (int i = 0; i < 4; i++)
                {
                    var equip = Hero.MainHero.CharacterObject.Equipment[i];
                    items.Add(equip.Item);
                }

                LPLog.Log("玩家背包道具数量 " + MobileParty.MainParty.ItemRoster.Count.ToString());

                foreach (ItemObject item2 in Items.All)
                {
                    if (item2 != null && !string.IsNullOrEmpty(item2.StringId) && item2.StringId.ToLower().Contains(NowModNameId) && !items.Contains(item2))
                    {
                        MobileParty.MainParty.ItemRoster.AddToCounts(new EquipmentElement(item2), 1);
                        LPLog.Log("添加道具 " + item2.Name.ToString());
                        InformationManager.DisplayMessage(new InformationMessage("添加道具 " + item2.Name.ToString(), new Color(.25f, 1, 0)));
                    }
                }
            }
            catch (Exception e)
            {
                LPLog.Log(e.Message);
                LPLog.LogInfoMessage("请存档后重新读取即可获取 虎头枪。\n Please Save and Reload later to get the TigerHeadQiang.");
            }

            return(true);
        }