Ejemplo n.º 1
0
 // Token: 0x0600002C RID: 44 RVA: 0x000049C0 File Offset: 0x00002BC0
 public override void SetDefaults(NPC npc)
 {
     if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese && ModLoader.GetMod("CalamityMod") != null)
     {
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("AquaticAberration"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "深海吞食者");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("Leviathan"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "利维坦");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("LeviathanStart"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "迷人的歌声?");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("Parasea"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "海蠕虫");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("Siren"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "塞壬");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("SirenClone"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "塞壬分身");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("SirenIce"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "冰护盾");
         }
     }
 }
Ejemplo n.º 2
0
        public static bool IsBadType(HologramMode mode, int type)
        {
            switch (mode)
            {
            case HologramMode.NPC:
                if (type < NPCLoader.NPCCount)
                {
                    return(false);
                }                                                                   //type < Main.npcTexture.Length
                return(NPCLoader.GetNPC(type) == null);

            case HologramMode.Item:
                if (type < ItemLoader.ItemCount)
                {
                    return(false);
                }                                                                   //type < Main.itemTexture.Length
                return(ItemLoader.GetItem(type) == null);

            case HologramMode.Projectile:
                if (type < ProjectileLoader.ProjectileCount)
                {
                    return(false);
                }                                                                               //type < Main.projectileTexture.Length
                return(ProjectileLoader.GetProjectile(type) == null);

            case HologramMode.Gore:
                return(type < 0 || type >= ModGore.GoreCount);

            //return Main.goreTexture[type] == null;
            default:
                throw new ModHelpersException("Invalid hologram type");
            }
        }
 // Token: 0x06000028 RID: 40 RVA: 0x000047C8 File Offset: 0x000029C8
 public override void SetDefaults(NPC npc)
 {
     if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese && ModLoader.GetMod("CalamityMod") != null && npc.type == ModLoader.GetMod("CalamityMod").NPCType("GreatSandShark"))
     {
         NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "旱海狂鲨");
     }
 }
 // Token: 0x06000018 RID: 24 RVA: 0x00003F4C File Offset: 0x0000214C
 public override void SetDefaults(NPC npc)
 {
     if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese && ModLoader.GetMod("CalamityMod") != null && (npc.type == ModLoader.GetMod("CalamityMod").NPCType("Bumblefuck") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("Bumblefuck2")))
     {
         NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "嗡嗡蜂鸟");
     }
 }
        // for the most part vanilla
        private void ForceColliding(On.Terraria.Player.orig_Update_NPCCollision orig, Player self)
        {
            Rectangle rectangle = new Rectangle((int)self.position.X, (int)self.position.Y, self.width, self.height);

            for (int i = 0; i < 200; i++)
            {
                if (!Main.npc[i].active || Main.npc[i].friendly || Main.npc[i].damage <= 0)
                {
                    continue;
                }

                var       npc             = Main.npc[i];
                int       type            = npc.type;
                Rectangle npcRect         = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height);
                int       specialHit      = -1;
                float     damageMultipler = 1;

                NPC.GetMeleeCollisionData(rectangle, i, ref specialHit, ref damageMultipler, ref npcRect);

                if (rectangle.Intersects(npcRect) && type == NPCType <ArenaBlocker>() && NPCLoader.CanHitPlayer(npc, self, ref specialHit))
                {
                    NPCLoader.OnHitPlayer(npc, self, npc.damage, false);

                    var dam  = npc.damage;
                    var crit = false;
                    NPCLoader.ModifyHitPlayer(npc, self, ref dam, ref crit);

                    return;
                }
            }
            orig(self);
        }
Ejemplo n.º 6
0
 // Token: 0x0600002A RID: 42 RVA: 0x00004830 File Offset: 0x00002A30
 public override void SetDefaults(NPC npc)
 {
     if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese && ModLoader.GetMod("CalamityMod") != null)
     {
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("DankCreeper"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "沼泽之眼");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("DarkHeart"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "暗之心");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("HiveBlob") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("HiveBlob2"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "腐化球");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("HiveCyst"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "腐化囊");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("HiveMind") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("HiveMindP2"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "腐巢意志");
         }
     }
 }
Ejemplo n.º 7
0
        internal static bool WriteNPCKillCounts(BinaryWriter writer)
        {
            byte[] data;
            ushort numCounts = 0;

            using (MemoryStream stream = new MemoryStream())
            {
                using (BinaryWriter countWriter = new BinaryWriter(stream))
                {
                    foreach (int type in NPCLoader.npcs.Keys)
                    {
                        if (NPC.killCount[type] > 0)
                        {
                            countWriter.Write(NPCLoader.GetNPC(type).mod.Name);
                            countWriter.Write(Main.npcName[type]);
                            countWriter.Write(NPC.killCount[type]);
                            numCounts++;
                        }
                    }
                    countWriter.Flush();
                    data = stream.ToArray();
                }
            }
            if (numCounts > 0)
            {
                writer.Write(numCounts);
                writer.Write(data);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 8
0
        public ModelLoaderBase LoadModel(GameObject go, bool need_shadow, bool enable_light_probe, Action <Animator> on_complete, bool useSpecialModel)
        {
            if (IsUsePlayerModel())
            {
                PlayerLoader   loader           = go.AddComponent <PlayerLoader>();
                PlayerLoadInfo player_load_info = CreatePlayerLoadInfo();
                loader.StartLoad(player_load_info, go.get_layer(), 99, false, false, need_shadow, enable_light_probe, false, false, FieldManager.IsValidInField(), true, (!enable_light_probe) ? SHADER_TYPE.UI : ShaderGlobal.GetCharacterShaderType(), delegate
                {
                    if (on_complete != null)
                    {
                        on_complete(loader.animator);
                    }
                }, true, -1);
                return(loader);
            }
            NPCLoader loader2 = go.AddComponent <NPCLoader>();

            HomeThemeTable.HomeThemeData homeThemeData = Singleton <HomeThemeTable> .I.GetHomeThemeData(TimeManager.GetNow());

            int num = Singleton <HomeThemeTable> .I.GetNpcModelID(homeThemeData, id);

            int num2         = (num <= 0) ? specialModelID : num;
            int npc_model_id = (!useSpecialModel || num2 <= 0) ? npcModelID : num2;

            loader2.Load(npc_model_id, go.get_layer(), need_shadow, enable_light_probe, (!enable_light_probe) ? SHADER_TYPE.UI : ShaderGlobal.GetCharacterShaderType(), delegate
            {
                if (on_complete != null)
                {
                    on_complete(loader2.animator);
                }
            });
            return(loader2);
        }
Ejemplo n.º 9
0
        public override void EditSpawnPool(IDictionary <int, float> pool, NPCSpawnInfo spawnInfo)
        {
            PokeModBlue.originalSpawnPool = pool;
            List <int> keys = new List <int>(pool.Keys);

            foreach (int key in keys)
            {
                // All NPCs Spawn
                if (PokeModBlue.pokeSpawns == 1)
                {
                    pool[key] = PokeModBlue.originalSpawnPool[key];
                    continue;
                }

                // Only Mod NPCs Spawn
                if (PokeModBlue.pokeSpawns == 2)
                {
                    ModNPC modNPC = NPCLoader.GetNPC(key);
                    if (modNPC != null)
                    {
                        pool[key] = PokeModBlue.originalSpawnPool[key];
                    }
                    else
                    {
                        pool[key] = 0f;
                    }
                    continue;
                }

                // Only Normal NPCs Spawn
                if (PokeModBlue.pokeSpawns == 3)
                {
                    ModNPC modNPC = NPCLoader.GetNPC(key);
                    if (modNPC != null)
                    {
                        pool[key] = 0f;
                    }
                    else
                    {
                        pool[key] = PokeModBlue.originalSpawnPool[key];
                    }
                    continue;
                }

                // Only Pokemon Spawn
                if (PokeModBlue.pokeSpawns == 4)
                {
                    PokemonNPC pokemonNPC = NPCLoader.GetNPC(key) as PokemonNPC;
                    if (pokemonNPC != null)
                    {
                        pool[key] = PokeModBlue.originalSpawnPool[key];
                    }
                    else
                    {
                        pool[key] = 0f;
                    }
                    continue;
                }
            }
        }
Ejemplo n.º 10
0
        bool canHit(NPC npc)
        {
            if (!(NPCLoader.CanBeHitByProjectile(npc, projectile) ?? true))
            {
                return(false);
            }
            if (!(PlayerHooks.CanHitNPCWithProj(projectile, npc) ?? true))
            {
                return(false);
            }
            Player player = Main.player[projectile.owner];

            if (npc.friendly)
            {
                switch (npc.type)
                {
                case NPCID.Guide:
                    return(player.killGuide);

                case NPCID.Clothier:
                    return(player.killClothier);

                default:
                    return(false);
                }
            }
            return(true);
        }
    private void Init(UITexture ui_tex, float fov, LOADER_TYPE loader_type = LOADER_TYPE.ITEM)
    {
        //IL_0071: Unknown result type (might be due to invalid IL or missing references)
        //IL_008c: Unknown result type (might be due to invalid IL or missing references)
        //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
        //IL_00c2: Unknown result type (might be due to invalid IL or missing references)
        if (model == null)
        {
            uiTexture       = ui_tex;
            uiRenderTexture = UIRenderTexture.Get(ui_tex, fov, false, -1);
            model           = Utility.CreateGameObject("UIModel", uiRenderTexture.modelTransform, uiRenderTexture.renderLayer);
            switch (loader_type)
            {
            case LOADER_TYPE.PLAYER:
                playerLoader = model.get_gameObject().AddComponent <PlayerLoader>();
                break;

            case LOADER_TYPE.NPC:
                npcLoader = model.get_gameObject().AddComponent <NPCLoader>();
                break;

            case LOADER_TYPE.ITEM:
                itemLoader = model.get_gameObject().AddComponent <ItemLoader>();
                break;

            case LOADER_TYPE.ENEMY:
                enemyLoader = model.get_gameObject().AddComponent <EnemyLoader>();
                break;
            }
            modelLayer = uiRenderTexture.renderLayer;
        }
    }
Ejemplo n.º 12
0
 // Token: 0x06000044 RID: 68 RVA: 0x0000665C File Offset: 0x0000485C
 public override void SetDefaults(NPC npc)
 {
     if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese && ModLoader.GetMod("CalamityMod") != null)
     {
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("SCalWormBody") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("SCalWormHead") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("SCalWormTail"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "灾坟虫");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("SCalWormBodyWeak") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("SCalWormHeart"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "灾坟虫心");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("SoulSeekerSupreme"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "至尊探魂眼");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "至尊灾厄");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("SupremeCataclysm"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "至尊灾祸");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("SupremeCatastrophe"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "至尊灾难");
         }
     }
 }
 // Token: 0x06000030 RID: 48 RVA: 0x000057D0 File Offset: 0x000039D0
 public override void SetDefaults(NPC npc)
 {
     if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese && ModLoader.GetMod("CalamityMod") != null)
     {
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorCyst"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "血肉囊");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorHive"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "血肉宿主");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorTailSmall") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorBodySmall") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorHeadSmall"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "弱体血肉寄生蠕虫");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorTailMedium") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorBodyMedium") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorHeadMedium"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "普通血肉寄生蠕虫");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorTailLarge") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorBodyLarge") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorHeadLarge"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "巨型血肉寄生蠕虫");
         }
     }
 }
 // Token: 0x0600001A RID: 26 RVA: 0x00003FD0 File Offset: 0x000021D0
 public override void SetDefaults(NPC npc)
 {
     if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese && ModLoader.GetMod("CalamityMod") != null)
     {
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("Calamitas"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "灾厄之影");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "灾祸");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun2"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "灾难");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "灾厄之影");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("LifeSeeker"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "探灵眼");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("SoulSeeker"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "搜魂眼");
         }
     }
 }
Ejemplo n.º 15
0
 // Token: 0x06000038 RID: 56 RVA: 0x00005C8C File Offset: 0x00003E8C
 public override void SetDefaults(NPC npc)
 {
     if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese && ModLoader.GetMod("CalamityMod") != null && (npc.type == ModLoader.GetMod("CalamityMod").NPCType("ProfanedGuardianBoss") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("ProfanedGuardianBoss2") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("ProfanedGuardianBoss3")))
     {
         NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "亵渎守卫");
     }
 }
Ejemplo n.º 16
0
        public void itembuy(Item item, TooltipLine linebuy)
        {
            FieldInfo shopToNPCField = typeof(NPCLoader).GetField("shopToNPC", BindingFlags.Static | BindingFlags.NonPublic);

            int[] shopToNPC = (int[])shopToNPCField.GetValue(null);
            for (int k = 0; k < 200; k++)
            {
                if (Main.npc[k].active && Main.npc[k].townNPC && NPCLoader.CanChat(Main.npc[k]))
                {
                    int type = Main.npc[k].type;
                    int shop = Array.IndexOf(shopToNPC, type);
                    if (shop == -1)
                    {
                        shop = Main.MaxShopIDs - 1;
                    }

                    Main.instance.shop[shop].SetupShop(shop == Main.MaxShopIDs - 1 ? type : shop);

                    foreach (var itemcan in Main.instance.shop[shop].item)
                    {
                        if (item.type == itemcan.type)
                        {
                            linebuy.text += Main.npc[k].TypeName + "\n";
                        }
                    }
                }
            }
            linebuy.overrideColor = Color.DeepSkyBlue;
        }
 public override void AI(NPC npc)
 {
     if (NPCLoader.PreAI(npc) && Main.masterMode)
     {
         currentMMRAI?.AI(npc);
     }
     base.AI(npc);
 }
Ejemplo n.º 18
0
            public override void PostUpdate()
            {
                if (Main.dedServ || !DisplayWorldTooltips)
                {
                    return;
                }
                Mod displayMod   = null;
                Mod modLoaderMod = ModLoader.GetMod("ModLoader");                 //modmodloadermodmodloadermodmodloader
                int mysteryTile  = modLoaderMod.TileType("MysteryTile");
                int mysteryTile2 = modLoaderMod.TileType("PendingMysteryTile");

                var tile = Main.tile[Player.tileTargetX, Player.tileTargetY];

                if (tile != null)
                {
                    if (tile.active() && tile.type != mysteryTile && tile.type != mysteryTile2)
                    {
                        var modTile = TileLoader.GetTile(tile.type);
                        if (modTile != null)
                        {
                            displayMod = modTile.mod;
                        }
                    }
                    else
                    {
                        var modWall = WallLoader.GetWall(tile.wall);
                        if (modWall != null)
                        {
                            displayMod = modWall.mod;
                        }
                    }
                }

                var mousePos = Main.MouseWorld;

                for (int i = 0; i < Main.maxNPCs; i++)
                {
                    var npc = Main.npc[i];
                    if (mousePos.Between(npc.TopLeft, npc.BottomRight))
                    {
                        var modNPC = NPCLoader.GetNPC(npc.type);
                        if (modNPC != null && npc.active && !NPCID.Sets.ProjectileNPC[npc.type])
                        {
                            displayMod = modNPC.mod;
                            SecondLine = true;
                            break;
                        }
                    }
                }
                if (displayMod != null)
                {
                    MouseText = String.Format("[c/{1}:[{0}][c/{1}:]]", displayMod.DisplayName, Colors.RarityBlue.Hex3());
                    if (Main.mouseText)
                    {
                        SecondLine = true;
                    }
                }
            }
        private bool hitAndAttachProjectile(NPC npc)
        {
            if (!npc.active || npc.immortal || npc.dontTakeDamage ||
                (npc.friendly && !(npc.type == NPCID.Guide && Main.player[projectile.owner].killGuide) && !(npc.type == NPCID.Clothier && Main.player[projectile.owner].killClothier))
                )
            {
                if (npc.type != NPCID.TargetDummy)
                {
                    return(false);
                }
            }
            bool?b = NPCLoader.CanBeHitByProjectile(npc, projectile);

            if (b.HasValue && !b.Value)
            {
                return(false);
            }
            b = ProjectileLoader.CanHitNPC(projectile, npc);
            if (b.HasValue && !b.Value)
            {
                return(false);
            }
            b = PlayerHooks.CanHitNPCWithProj(projectile, npc);
            if (b.HasValue && !b.Value)
            {
                return(false);
            }

            npcIndex = (short)npc.whoAmI;
            npc.GetGlobalNPC <FishGlobalNPC>(mod).isHooked++;
            if (Main.player[projectile.owner].GetModPlayer <FishPlayer>(mod).seals)
            {
                npc.GetGlobalNPC <FishGlobalNPC>(mod).isSealed++;
            }
            projectile.Center = npc.Center;
            updatePos         = false;

            if (Main.netMode != 0)
            {
                /*
                 * ModPacket pk = mod.GetPacket();
                 * pk.Write((byte)2);
                 * pk.Write((ushort)(projectile.whoAmI));
                 * pk.Write(npcIndex);
                 * pk.Write(projectile.ai[0]);
                 * pk.Send();*/
                NetMessage.SendData(27, -1, -1, null, projectile.whoAmI, 0f, 0f, 0f, 0, 0, 0);
            }

            /*  if(projectile.damage > 0)
             * {
             *    //Main.NewText("Entered npc " + npcIndex + " into bobber " + projectile.whoAmI + " from player " + projectile.owner + ";");
             *    damageNPC(npc);
             * }*/
            return(true);
        }
Ejemplo n.º 20
0
        private static void NPC_VanillaAI(On.Terraria.NPC.orig_VanillaAI orig, NPC self)
        {
            MMRGlobalNPC globalNPC = self.GetGlobalNPC <MMRGlobalNPC>();

            if (globalNPC?.currentMMRAI != null && NPCLoader.PreAI(self) && Main.masterMode)
            {
                globalNPC.currentMMRAI.PreVanillaAI(self);
            }
            orig(self);
        }
Ejemplo n.º 21
0
    protected NPCLoader LoadNPC()
    {
        //IL_0013: Unknown result type (might be due to invalid IL or missing references)
        Transform val       = Utility.CreateGameObject("NPC", npcPosition, -1);
        NPCLoader nPCLoader = val.get_gameObject().AddComponent <NPCLoader>();

        nPCLoader.Load(Singleton <NPCTable> .I.GetNPCData(2).npcModelID, 0, false, true, SHADER_TYPE.NORMAL, null);
        objects.Add(nPCLoader);
        return(nPCLoader);
    }
Ejemplo n.º 22
0
            public override void PostUpdate()
            {
                if (Main.dedServ || !DisplayWorldTooltips)
                {
                    return;
                }
                MouseText  = String.Empty;
                SecondLine = false;
                var modLoaderMod = ModLoader.GetMod("ModLoader");                 //modmodloadermodmodloadermodmodloader
                int mysteryTile  = modLoaderMod.TileType("MysteryTile");
                int mysteryTile2 = modLoaderMod.TileType("PendingMysteryTile");

                var tile = Main.tile[Player.tileTargetX, Player.tileTargetY];

                if (tile != null)
                {
                    if (tile.active() && tile.type != mysteryTile && tile.type != mysteryTile2)
                    {
                        var modTile = TileLoader.GetTile(tile.type);
                        if (modTile != null)
                        {
                            MouseText = DisplayTechnicalNames ? (modTile.mod.Name + ":" + modTile.Name) : modTile.mod.DisplayName;
                        }
                    }
                    else
                    {
                        var modWall = WallLoader.GetWall(tile.wall);
                        if (modWall != null)
                        {
                            MouseText = DisplayTechnicalNames ? (modWall.mod.Name + ":" + modWall.Name) : modWall.mod.DisplayName;
                        }
                    }
                }

                var mousePos = Main.MouseWorld;

                for (int i = 0; i < Main.maxNPCs; i++)
                {
                    var npc = Main.npc[i];
                    if (mousePos.Between(npc.TopLeft, npc.BottomRight))
                    {
                        var modNPC = NPCLoader.GetNPC(npc.type);
                        if (modNPC != null && npc.active && !NPCID.Sets.ProjectileNPC[npc.type])
                        {
                            MouseText  = DisplayTechnicalNames ? (modNPC.mod.Name + ":" + modNPC.Name) : modNPC.mod.DisplayName;
                            SecondLine = true;
                            break;
                        }
                    }
                }
                if (MouseText != String.Empty && Main.mouseText)
                {
                    SecondLine = true;
                }
            }
Ejemplo n.º 23
0
 public string getCurrentMobName()
 {
     if (NPCLoader.GetNPC(mobID) != null)
     {
         return(NPCLoader.GetNPC(mobID).DisplayName.GetDefault());
     }
     else
     {
         return(Lang.GetNPCNameValue(mobID));
     }
 }
Ejemplo n.º 24
0
 public void setMob(int newMobId)
 {
     this.mobID = newMobId;
     if (NPCLoader.GetNPC(newMobId) != null)
     {
         Main.NewText("Successfully changed mob to " + NPCLoader.GetNPC(newMobId).DisplayName.GetDefault());
     }
     else
     {
         Main.NewText("Successfully changed mob to " + Lang.GetNPCNameValue(newMobId));
     }
 }
Ejemplo n.º 25
0
        public void BanishAction(NPC npc)
        {
            npc.velocity.X = 0;
            npc.velocity.Y = 0;
            npc.scale     -= 0.01f;
            npc.alpha     += 4;

            if (BanishCount > 70 || npc.alpha >= 250 || npc.scale < 0.05f)
            {
                Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("InvokedHeal"), 0, 0f, Main.player[Main.myPlayer].whoAmI, Main.player[Main.myPlayer].whoAmI, npc.lifeMax * 0.01f);

                if (npc.type == NPCID.MoonLordHead || npc.type == NPCID.MoonLordHand)
                {
                    for (int i = 0; i < 200; i++)
                    {
                        if (Main.npc[i].type == NPCID.MoonLordCore || Main.npc[i].type == NPCID.MoonLordHead || Main.npc[i].type == NPCID.MoonLordHand)
                        {
                            Main.npc[i].active = false;
                            Main.npc[i].NPCLoot();
                        }
                    }
                }


                if (npc.realLife >= 0)
                {
                    if (npc.type == 13)
                    {
                        Main.npc[npc.realLife].boss = true;
                    }
                    Main.npc[npc.realLife].NPCLoot();                    //This need change in AAMod
                    for (int i = 0; i < 200; i++)
                    {
                        if (Main.npc[i].realLife == npc.realLife)
                        {
                            Main.npc[i].NPCLoot();
                            Main.npc[i].active = false;
                        }
                    }
                    NPCLoader.CheckDead(Main.npc[npc.realLife]);
                    Main.npc[npc.realLife].checkDead();
                    Main.npc[npc.realLife].netUpdate = true;
                }
                npc.NPCLoot();                //This need change in AAMod
                NPCLoader.CheckDead(npc);
                npc.checkDead();
                npc.active    = false;
                npc.life      = 0;
                npc.netUpdate = true;
                BanishCount   = 0;
            }
        }
Ejemplo n.º 26
0
        public override void AI()
        {
            frameCounter++;
            if (frameCounter >= 600)
            {
                var t    = mod.NPCType("DarkSpike");
                var tile = npc.Center.ToTileCoordinates();
                NPCLoader.GetNPC(t).SpawnNPC(tile.X, tile.Y);
                //npc.NewNPC(  //(int X, int Y, int Type, int Start = 0, float ai0 = 0, float ai1 = 0, float ai2 = 0, float ai3 = 0, int Target = 255);

                frameCounter = 0;
            }
        }
Ejemplo n.º 27
0
        public override void PostAI(NPC npc)
        {
            if (npc.townNPC)
            {
                Player player  = Main.player[Main.myPlayer];
                int    talkNPC = player.talkNPC;

                if (talkNPC != -1)
                {
                    if (Main.npc[talkNPC].type == NPCID.Guide && Main.InGuideCraftMenu == false)
                    {
                        NMDHelper.OpenCraftingMenu();
                    }
                    if (Main.npc[talkNPC].type == NPCID.Nurse)
                    {
                        if (NoMoreDialogues.nurseQuickHeal)
                        {
                            NMDHelper.Heal();
                        }
                    }
                    if (npcs.ContainsKey(Main.npc[talkNPC].type))
                    {
                        int shopId = (int)npcs[Main.npc[talkNPC].type];
                        if (Main.npcShop != shopId)
                        {
                            NMDHelper.OpenShop(shopId);
                        }
                    }
                    if (Main.npc[talkNPC].type == NPCID.TaxCollector)
                    {
                        NMDHelper.CollectTax();
                    }

                    if (npc.modNPC != null)
                    {
                        if (Main.npcShop != 22)
                        {
                            if (Main.npc[talkNPC].type == npc.type)
                            {
                                NPCLoader.OnChatButtonClicked(true);
                                player.talkNPC = talkNPC;
                                string chat = "";
                                NPCLoader.GetChat(npc, ref chat);
                                Main.npcChatText = chat;
                            }
                        }
                    }
                }
            }
            base.PostAI(npc);
        }
Ejemplo n.º 28
0
 // Token: 0x06000022 RID: 34 RVA: 0x00004460 File Offset: 0x00002660
 public override void SetDefaults(NPC npc)
 {
     if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese && ModLoader.GetMod("CalamityMod") != null)
     {
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("CrabShroom"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "蟹菌");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("CrabulonIdle"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "菌生蟹");
         }
     }
 }
Ejemplo n.º 29
0
        public void MeleeHit(NPC npc)
        {
            if (npc.dontTakeDamage)
            {
                return;
            }
            int specialHitSitter = 1;

            if (npc.immune[254] == 0)
            {
                int       immuneTime = 30;
                Rectangle hitbox     = npc.Hitbox;
                foreach (NPC attacker in Main.npc)
                {
                    if (attacker.active && attacker.whoAmI != npc.whoAmI && CheckForHit(npc, attacker))                    //CheckRealLife(npc, attacker))
                    {
                        if (!attacker.friendly && attacker.damage > 0)
                        {
                            Rectangle hitbox2          = attacker.Hitbox;
                            float     damageMultiplier = 1f;
                            NPC.GetMeleeCollisionData(hitbox, attacker.whoAmI, ref specialHitSitter, ref damageMultiplier, ref hitbox2);
                            bool?flag = NPCLoader.CanHitNPC(attacker, npc);
                            if ((flag == null || flag.Value) && hitbox.Intersects(hitbox2) && ((flag != null && flag.Value) || npc.type != NPCID.SkeletonMerchant || !NPCID.Sets.Skeletons.Contains(attacker.netID)))
                            {
                                int dmg = attacker.damage;
                                dmg *= EvE.config.MeleeDamageMultiplier;

                                float kb           = 6f;
                                int   hitDirection = 1;
                                if (attacker.Center.X > npc.Center.X)
                                {
                                    hitDirection = -1;
                                }
                                bool crit = Main.rand.NextFloat() > 0.75f;
                                NPCLoader.ModifyHitNPC(attacker, npc, ref dmg, ref kb, ref crit);
                                double realDmg = npc.StrikeNPCNoInteraction(dmg, kb, hitDirection, crit, false, false);
                                if (Main.netMode != NetmodeID.SinglePlayer)
                                {
                                    NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, dmg, kb, hitDirection, 0, 0, 0);
                                }
                                npc.netUpdate   = true;
                                npc.immune[254] = immuneTime;
                                AddBuffToTheEnemy(attacker, npc);
                                NPCLoader.OnHitNPC(attacker, npc, (int)realDmg, kb, crit);
                            }
                        }
                    }
                }
            }
        }
 // Token: 0x06000014 RID: 20 RVA: 0x00003D38 File Offset: 0x00001F38
 public override void SetDefaults(NPC npc)
 {
     if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese && ModLoader.GetMod("CalamityMod") != null)
     {
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusBody") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusBodySpectral") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusHead") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusHeadSpectral") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusTail") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusTailSpectral"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "星神游龙");
         }
         if (npc.type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusProbe") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusProbe2") || npc.type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusProbe3"))
         {
             NPCLoader.GetNPC(npc.type).DisplayName.AddTranslation(GameCulture.Chinese, "星神探测器");
         }
     }
 }