コード例 #1
0
ファイル: TsunamiProj.cs プロジェクト: DarthHA/NPCAttacker
        public override void AttackEffect()
        {
            Item item = new Item();

            item.SetDefaults(ItemID.Tsunami);
            int ammo = SomeUtils.PickAmmo(item);

            if (ammo == 0)
            {
                return;
            }
            float   num121   = 0.314159274f;
            int     num122   = 5;
            Vector2 vector15 = projectile.velocity;

            vector15.Normalize();
            vector15 *= 40f;
            bool flag13 = Collision.CanHit(projectile.Center, 0, 0, projectile.Center + vector15, 0, 0);

            for (int num123 = 0; num123 < num122; num123++)
            {
                float   num124   = num123 - (num122 - 1f) / 2f;
                Vector2 vector16 = vector15.RotatedBy(num121 * num124, default);
                if (!flag13)
                {
                    vector16 -= vector15;
                }
                int protmp = Projectile.NewProjectile(projectile.Center + vector16, projectile.velocity, ammo, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
                Main.projectile[protmp].npcProj              = true;
                Main.projectile[protmp].noDropItem           = true;
                Main.projectile[protmp].usesLocalNPCImmunity = true;
                Main.projectile[protmp].localNPCHitCooldown  = 10;
            }
        }
コード例 #2
0
        public override void AttackEffect()
        {
            Item item = new Item();

            item.SetDefaults(ItemID.OnyxBlaster);
            int ammo = SomeUtils.PickAmmo(item);

            if (ammo == 0)
            {
                return;
            }
            Vector2 vector29 = projectile.velocity;
            float   num210   = 0.7853982f;
            int     protmp;

            for (int num211 = 0; num211 < 2; num211++)
            {
                protmp = Projectile.NewProjectile(projectile.Center, vector29 + vector29.SafeNormalize(Vector2.Zero).RotatedBy(num210 * (Main.rand.NextFloat() * 0.5f + 0.5f), default) * Main.rand.NextFloatDirection() * 2f, ammo, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
                Main.projectile[protmp].npcProj              = true;
                Main.projectile[protmp].noDropItem           = true;
                Main.projectile[protmp].usesLocalNPCImmunity = true;
                Main.projectile[protmp].localNPCHitCooldown  = 10;
                protmp = Projectile.NewProjectile(projectile.Center, vector29 + vector29.SafeNormalize(Vector2.Zero).RotatedBy(-num210 * (double)(Main.rand.NextFloat() * 0.5f + 0.5f), default) * Main.rand.NextFloatDirection() * 2f, ammo, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
                Main.projectile[protmp].npcProj              = true;
                Main.projectile[protmp].noDropItem           = true;
                Main.projectile[protmp].usesLocalNPCImmunity = true;
                Main.projectile[protmp].localNPCHitCooldown  = 10;
            }
            protmp = Projectile.NewProjectile(projectile.Center, vector29.SafeNormalize(Vector2.UnitX * Math.Sign(projectile.velocity.X)) * (projectile.velocity.Length() * 1.3f), ProjectileID.BlackBolt, projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, 0f);
            Main.projectile[protmp].npcProj              = true;
            Main.projectile[protmp].noDropItem           = true;
            Main.projectile[protmp].usesLocalNPCImmunity = true;
            Main.projectile[protmp].localNPCHitCooldown  = 10;
        }
コード例 #3
0
        public override void AttackEffect()
        {
            Item item = new Item();

            item.SetDefaults(ItemID.Xenopopper);
            int ammo = SomeUtils.PickAmmo(item);

            if (ammo == 0)
            {
                return;
            }
            Vector2 vector2 = projectile.Center;
            Vector2 value3  = Vector2.Normalize(projectile.velocity) * 40f * item.scale;

            if (Collision.CanHit(vector2, 0, 0, vector2 + value3, 0, 0))
            {
                vector2 += value3;
            }
            float ai     = projectile.velocity.ToRotation();
            float num100 = 2.09439516f;
            int   num101 = Main.rand.Next(4, 5);

            if (Main.rand.Next(4) == 0)
            {
                num101++;
            }
            for (int num102 = 0; num102 < num101; num102++)
            {
                float   scaleFactor2 = (float)Main.rand.NextDouble() * 0.2f + 0.05f;
                Vector2 vector11     = projectile.velocity.RotatedBy(num100 * (float)Main.rand.NextDouble() - num100 / 2f, default) * scaleFactor2;
コード例 #4
0
        public override void AttackEffect()
        {
            Item item = new Item();

            item.SetDefaults(ItemID.Boomstick);
            int ammo = SomeUtils.PickAmmo(item);

            if (ammo == 0)
            {
                return;
            }
            int num146 = Main.rand.Next(3, 5);

            for (int num147 = 0; num147 < num146; num147++)
            {
                float num148 = projectile.velocity.X;
                float num149 = projectile.velocity.Y;
                num148 += Main.rand.Next(-35, 36) * 0.04f;
                num149 += Main.rand.Next(-35, 36) * 0.04f;
                int protmp = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num148, num149, ammo, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
                Main.projectile[protmp].npcProj              = true;
                Main.projectile[protmp].noDropItem           = true;
                Main.projectile[protmp].usesLocalNPCImmunity = true;
                Main.projectile[protmp].localNPCHitCooldown  = 10;
            }
        }
コード例 #5
0
ファイル: EqmSv.cs プロジェクト: liyihan20/Ele_Sale
        public void SaveDeliveryBill(System.Web.Mvc.FormCollection fc, UserInfo user)
        {
            Sale_eqm_ch_bill bill = new Sale_eqm_ch_bill();

            SomeUtils.SetFieldValueToModel(fc, bill);
            List <Sale_eqm_ch_bill_detail> details = JsonConvert.DeserializeObject <List <Sale_eqm_ch_bill_detail> >(fc.Get("ch_bill_details"));

            bill.FUserName = user.realName;
            bill.FSaveDate = DateTime.Now;
            bill.Sale_eqm_ch_bill_detail.AddRange(details);

            if (string.IsNullOrEmpty(bill.FSysNo))
            {
                bill.FSysNo = GetNextSysNo();
            }
            else
            {
                var existedBill = db.Sale_eqm_ch_bill.Where(s => s.FSysNo == bill.FSysNo && (s.FDeleted == null || s.FDeleted == false)).FirstOrDefault();
                if (existedBill != null)
                {
                    existedBill.FDeleted = true;
                }
            }

            db.Sale_eqm_ch_bill.InsertOnSubmit(bill);
            db.SubmitChanges();
        }
コード例 #6
0
 public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
 {
     if (npc.townNPC || npc.type == NPCID.SkeletonMerchant)
     {
         if (SomeUtils.BuffNPC())
         {
             if (npc.HasBuff(BuffID.DryadsWard))
             {
                 int ExtraDef = 0;
                 if (NPC.downedMoonlord)
                 {
                     ExtraDef = 10;
                 }
                 else if (NPC.downedPlantBoss)
                 {
                     ExtraDef = 5;
                 }
                 else if (Main.hardMode)
                 {
                     ExtraDef = 3;
                 }
                 if (!Main.expertMode)
                 {
                     ExtraDef = (int)(ExtraDef * 0.6f);
                 }
                 damage -= ExtraDef;
                 if (damage < 1.0)
                 {
                     damage = 1.0;
                 }
             }
         }
     }
     return(true);
 }
コード例 #7
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            HttpContextBase ctx = filterContext.HttpContext;

            if (ctx.Session != null)
            {
                //sessionCookie="ASP.NET_SessionId=xmxajqztk0ggqf3anpzxoqmy; order_cookie=userid=1&code=9775f157819fc0abc2d227a19f181176"
                string sessionCookie = ctx.Request.Headers["Cookie"];
                if ((null != sessionCookie) && (sessionCookie.IndexOf("order_ele_cookie") >= 0))
                {
                    var result = new Regex(@"(?<=order_ele_cookie=(?:code=.{32}&)?userid=)\d+").Match(sessionCookie);
                    if (result.Success)
                    {
                        string id = result.Value;
                        result = new Regex(@"(?<=order_ele_cookie=(?:userid=\d+&)?code=).{32}").Match(sessionCookie);
                        if (result.Success)
                        {
                            string code = result.Value;
                            if (code.Equals(SomeUtils.getMD5(id)))
                            {
                                base.OnActionExecuting(filterContext);
                                return;
                            }
                        }
                    }
                }
            }
            filterContext.Result = new RedirectResult("~/Account/Login");
            //ctx.Response.Redirect("~/Account/Login");--虽可正常运行,但在调试模式下回出错,因为还是会在Action里面继续执行。
        }
コード例 #8
0
ファイル: CommissionSv.cs プロジェクト: liyihan20/Ele_Sale
        public string SaveCommission(CommissionRate cr, int userId)
        {
            if (db.CommissionRate.Where(c => c.id != cr.id && c.end_date > cr.begin_date && c.begin_date < cr.end_date && c.product_type == cr.product_type).Count() > 0)
            {
                return("此时间段与之前设置的时间段有重叠,保存失败");
            }
            try {
                if (cr.id != 0)
                {
                    //更新,将旧的删除
                    CommissionRate existed = db.CommissionRate.Single(c => c.id == cr.id);
                    BackupData     bd      = new BackupData();
                    bd.user_id        = userId;
                    bd.sys_no         = "佣金率维护";
                    bd.op_date        = DateTime.Now;
                    bd.main_data      = SomeUtils.ModelToString <CommissionRate>(existed);
                    bd.secondary_data = SomeUtils.ModelsToString <CommissionRateDetail>(existed.CommissionRateDetail.ToList());
                    db.BackupData.InsertOnSubmit(bd);

                    db.CommissionRateDetail.DeleteAllOnSubmit(existed.CommissionRateDetail);
                    db.CommissionRate.DeleteOnSubmit(existed);
                }

                db.CommissionRate.InsertOnSubmit(cr);
                db.SubmitChanges();
            }
            catch (Exception ex) {
                return(ex.Message);
            }

            return("");
        }
コード例 #9
0
 public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
 {
     Main.player[projectile.owner].statLife = Utils.Clamp(Main.player[projectile.owner].statLife + 2, 0, Main.player[projectile.owner].statLifeMax2);
     Main.player[projectile.owner].HealEffect(2);
     //Twilight.DeepAddBuff(target, ModContent.BuffType<TwilightStunnedBuff>(), 80);
     SomeUtils.DeepApplyStun(target, 80);
 }
コード例 #10
0
ファイル: ApoBirdGNPC.cs プロジェクト: DarthHA/Twilight
 public override bool PreAI(NPC npc)
 {
     if (FakeModPlayer.Initialised)
     {
         if (Main.player[EyeLantern.FakePlayer].active)
         {
             npc.target = EyeLantern.FakePlayer;
         }
     }
     if (FakeModPlayer.AnyLanterns2() == -1)
     {
         if (npc.target == EyeLantern.FakePlayer)
         {
             npc.target = Main.myPlayer;
         }
     }
     if (SomeUtils.HasStun(npc))
     {
         if (OldVel == null)
         {
             OldVel = npc.velocity;
         }
         npc.velocity = Vector2.Zero;
         return(false);
     }
     else
     {
         if (OldVel != null)
         {
             npc.velocity = (Vector2)OldVel;
             OldVel       = null;
         }
     }
     return(true);
 }
コード例 #11
0
        public JsonResult SaveCommission(FormCollection fc)
        {
            CommissionRate cr      = new CommissionRate();
            string         details = fc.Get("commissionRateDetails");

            SomeUtils.SetFieldValueToModel(fc, cr);
            cr.CommissionRateDetail.AddRange(JsonConvert.DeserializeObject <List <CommissionRateDetail> >(fc.Get("commissionRateDetails")));

            if (cr.id == 0)
            {
                cr.create_date = DateTime.Now;
            }
            cr.update_date = DateTime.Now;
            cr.user_name   = currentUser.realName;

            string result = new CommissionSv().SaveCommission(cr, currentUser.userId);

            if (!string.IsNullOrEmpty(result))
            {
                return(Json(new ResultModel()
                {
                    suc = false, msg = result
                }, "text/html"));
            }

            return(Json(new ResultModel()
            {
                suc = true, msg = "保存成功"
            }, "text/html"));
        }
コード例 #12
0
ファイル: UserSv.cs プロジェクト: liyihan20/Ele_Sale
        public string SaveUser(UsersInfo uInfo)
        {
            if (db.User.Where(u => u.username == uInfo.userName).Count() > 0)
            {
                return("用户名已存在,保存失败");
            }
            try {
                User user = new User()
                {
                    username      = uInfo.userName,
                    real_name     = uInfo.realName,
                    email         = uInfo.email,
                    department_no = db.Department.Single(d => d.name == uInfo.depName && d.dep_type == "部门").dep_no,
                    is_forbit     = false,
                    in_date       = DateTime.Now,
                    error_times   = 0,
                    password      = SomeUtils.getMD5("000000")
                };
                db.User.InsertOnSubmit(user);
                db.SubmitChanges();
            }
            catch (Exception ex) {
                return(ex.Message);
            }

            return("");
        }
コード例 #13
0
ファイル: ShotgunProj.cs プロジェクト: DarthHA/NPCAttacker
        public override void AttackEffect()
        {
            Item item = new Item();

            item.SetDefaults(ItemID.Shotgun);
            int ammo = SomeUtils.PickAmmo(item);

            if (ammo == 0)
            {
                return;
            }
            int num130 = Main.rand.Next(4, 6);

            for (int num131 = 0; num131 < num130; num131++)
            {
                float num132 = projectile.velocity.X;
                float num133 = projectile.velocity.Y;
                num132 += Main.rand.Next(-40, 41) * 0.05f;
                num133 += Main.rand.Next(-40, 41) * 0.05f;
                int protmp = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num132, num133, ammo, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
                Main.projectile[protmp].npcProj              = true;
                Main.projectile[protmp].noDropItem           = true;
                Main.projectile[protmp].usesLocalNPCImmunity = true;
                Main.projectile[protmp].localNPCHitCooldown  = 10;
            }
        }
コード例 #14
0
ファイル: ArmedGNPC.cs プロジェクト: DarthHA/NPCAttacker
        public override void TownNPCAttackSwing(NPC npc, ref int itemWidth, ref int itemHeight)
        {
            if (!SomeUtils.BuffNPC())
            {
                return;
            }
            if (Weapon.IsAir)
            {
                return;
            }

            itemWidth  = Weapon.width;
            itemHeight = Weapon.height;
            if (Weapon.shoot != ProjectileID.None)
            {
                if (!MeleeAttacked)
                {
                    MeleeAttacked = true;

                    bool    ShouldShoot = true;
                    int     shoot       = Weapon.shoot;
                    int     dmg         = Main.LocalPlayer.GetWeaponDamage(Weapon);
                    float   Kb          = Main.LocalPlayer.GetWeaponKnockback(Weapon, Weapon.knockBack);
                    Vector2 Pos         = npc.Center;
                    Vector2 Speed;
                    if (SomeUtils.AttackMode())
                    {
                        Speed = Vector2.Normalize(Main.MouseWorld - npc.Center) * Weapon.shootSpeed;
                    }
                    else
                    {
                        Speed = new Vector2(1, 0) * npc.direction * Weapon.shootSpeed;
                    }
                    if (Weapon.modItem != null)
                    {
                        ShouldShoot = Weapon.modItem.Shoot(Main.LocalPlayer, ref Pos, ref Speed.X, ref Speed.Y, ref shoot, ref dmg, ref Kb);
                    }
                    if (ShouldShoot)
                    {
                        if (VanillaItemProjFix.TransFormProj(Weapon.type) != -1)
                        {
                            shoot = VanillaItemProjFix.TransFormProj(Weapon.type);
                        }
                        int protmp = Projectile.NewProjectile(Pos, Speed, shoot, dmg, Kb, Main.myPlayer);
                        Main.projectile[protmp].npcProj              = true;
                        Main.projectile[protmp].noDropItem           = true;
                        Main.projectile[protmp].usesLocalNPCImmunity = true;
                        if (Main.projectile[protmp].localNPCHitCooldown > 10)
                        {
                            Main.projectile[protmp].localNPCHitCooldown = 10;
                        }
                    }
                    if (Weapon.UseSound != null)
                    {
                        Main.PlaySound(Weapon.UseSound, npc.Center);
                    }
                }
            }
        }
コード例 #15
0
ファイル: ApoBirdGNPC.cs プロジェクト: DarthHA/Twilight
 public override void ModifyHitNPC(NPC npc, NPC target, ref int damage, ref float knockback, ref bool crit)
 {
     if (SomeUtils.HasParadise(npc))
     {
         damage /= 2;
     }
     damage -= (int)(GetLanternK(npc) * damage);
 }
コード例 #16
0
ファイル: ApoBirdGNPC.cs プロジェクト: DarthHA/Twilight
 public override void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit)
 {
     if (SomeUtils.HasParadise(npc))
     {
         damage /= 2;
     }
     damage -= (int)(GetLanternK(npc) * damage);
 }
コード例 #17
0
ファイル: CHSv.cs プロジェクト: liyihan20/Ele_Sale
        public override string SaveBill(System.Web.Mvc.FormCollection fc, UserInfo user)
        {
            bill = new ChBill();
            SomeUtils.SetFieldValueToModel(fc, bill);
            List <ChBillDetail> details = JsonConvert.DeserializeObject <List <ChBillDetail> >(fc.Get("ch_bill_details"));

            bill.ChBillDetail.AddRange(details);

            try {
                //保存送货地址信息
                var dInfos = new OtherSv().GetDeliveryInfo(bill.customer_no)
                             .Where(d => d.deliveryUnit == bill.delivery_unit && d.attn == bill.delivery_attn &&
                                    d.addr == bill.delivery_addr && d.phone == bill.delivery_phone).Count();
                if (dInfos == 0)
                {
                    var info = new CustomerDeliveryInfo()
                    {
                        customer_name   = bill.customer_name,
                        customer_number = bill.customer_no,
                        delivery_unit   = bill.delivery_unit,
                        addr            = bill.delivery_addr,
                        attn            = bill.delivery_attn,
                        phone           = bill.delivery_phone,
                        op_date         = DateTime.Now,
                        op_name         = user.realName
                    };
                    db.CustomerDeliveryInfo.InsertOnSubmit(info);
                }

                var existsed = db.ChBill.Where(c => c.sys_no == bill.sys_no).ToList();
                if (existsed.Count() > 0)
                {
                    //备份旧单
                    BackupData bd = new BackupData();
                    bd.sys_no         = bill.sys_no;
                    bd.op_date        = DateTime.Now;
                    bd.user_id        = user.userId;
                    bd.main_data      = SomeUtils.ModelToString <ChBill>(existsed.First());
                    bd.secondary_data = SomeUtils.ModelsToString <ChBillDetail>(existsed.First().ChBillDetail.ToList());
                    db.BackupData.InsertOnSubmit(bd);

                    //删掉旧单
                    db.ChBillDetail.DeleteAllOnSubmit(existsed.First().ChBillDetail);
                    db.ChBill.DeleteAllOnSubmit(existsed);
                }
                bill.bill_date = DateTime.Now;
                bill.user_id   = user.userId;

                db.ChBill.InsertOnSubmit(bill);
                db.ChBillDetail.InsertAllOnSubmit(bill.ChBillDetail);
                db.SubmitChanges();
            }
            catch (Exception ex) {
                return(ex.Message);
            }

            return("");
        }
コード例 #18
0
 public override bool?CanChat(NPC npc)
 {
     if (npc.townNPC || npc.type == NPCID.SkeletonMerchant)
     {
         if (SomeUtils.AssembleMode() || SomeUtils.AttackMode())
         {
             return(false);
         }
     }
     return(null);
 }
コード例 #19
0
ファイル: FileController.cs プロジェクト: liyihan20/Ele_Sale
        public void ExportAuditorExcel(string billType, FormCollection fc)
        {
            AuditSearchParamModel pm = new AuditSearchParamModel();

            SomeUtils.SetFieldValueToModel(fc, pm);

            BillSv bill = (BillSv) new BillUtils().GetBillSvInstance(billType);

            Wlog("审核人导出Excel:" + JsonConvert.SerializeObject(pm), billType);

            bill.ExportAuditorExcle(pm, currentUser.userId);
        }
コード例 #20
0
ファイル: FileController.cs プロジェクト: liyihan20/Ele_Sale
        /// <summary>
        /// 营业单据列表页面,导出Excel
        /// </summary>
        /// <param name="fc">form表单</param>
        public void ExportSalerExcel(FormCollection fc)
        {
            SalerSearchParamModel pm = new SalerSearchParamModel();

            SomeUtils.SetFieldValueToModel(fc, pm);

            BillSv bill = (BillSv) new BillUtils().GetBillSvInstance(pm.billType);

            Wlog("营业员导出Excel:" + JsonConvert.SerializeObject(pm));

            bill.ExportSalerExcle(pm, currentUser.userId);
        }
コード例 #21
0
ファイル: HomeController.cs プロジェクト: liyihan20/Ele_Sale
        public ActionResult Main(string url)
        {
            Session.Clear();
            var ua = new UA(currentUser.userId);

            ViewData["url"]      = string.IsNullOrEmpty(url) ? "" : SomeUtils.MyUrlDecoder(url);
            ViewData["powers"]   = ua.GetUserPowers();
            ViewData["username"] = currentUser.realName;
            ViewData["depName"]  = ua.GetUserDepartmentName();
            ViewData["copName"]  = currentAccount.Equals("ele") ? "信利电子有限公司" : "信利仪器/工业有限公司";
            return(View());
        }
コード例 #22
0
ファイル: ArmedGNPC.cs プロジェクト: DarthHA/NPCAttacker
 public override void DrawTownAttackGun(NPC npc, ref float scale, ref int item, ref int closeness)
 {
     if (!SomeUtils.BuffNPC())
     {
         return;
     }
     if (Weapon.IsAir)
     {
         return;
     }
     item = Weapon.type;
 }
コード例 #23
0
        public override string SaveBill(System.Web.Mvc.FormCollection fc, UserInfo user)
        {
            bill = new Sale_eo_bill();
            SomeUtils.SetFieldValueToModel(fc, bill);
            bill.Sale_eo_bill_detail.AddRange(JsonConvert.DeserializeObject <List <Sale_eo_bill_detail> >(fc.Get("details")));

            if (string.IsNullOrEmpty(bill.clerk_no))
            {
                return("营业员请输入厂牌或姓名然后按回车键搜索后,在列表中选择");
            }

            try {
                var existedBill = db.Sale_eo_bill.Where(s => s.sys_no == bill.sys_no).FirstOrDefault();
                if (existedBill != null)
                {
                    bill.applier_id   = existedBill.applier_id;
                    bill.applier_name = existedBill.applier_name;
                    bill.apply_time   = existedBill.apply_time;

                    //备份
                    JsonSerializerSettings js = new JsonSerializerSettings()
                    {
                        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                    };
                    BackupData bd = new BackupData();
                    bd.op_date        = DateTime.Now;
                    bd.sys_no         = existedBill.sys_no;
                    bd.user_id        = user.userId;
                    bd.main_data      = JsonConvert.SerializeObject(existedBill, js);
                    bd.secondary_data = JsonConvert.SerializeObject(existedBill.Sale_eo_bill_detail, js);
                    db.BackupData.InsertOnSubmit(bd);

                    //删除
                    db.Sale_eo_bill_detail.DeleteAllOnSubmit(existedBill.Sale_eo_bill_detail);
                    db.Sale_eo_bill.DeleteOnSubmit(existedBill);
                }
                else
                {
                    bill.applier_id   = user.userId;
                    bill.applier_name = user.realName;
                    bill.apply_time   = DateTime.Now;
                }

                db.Sale_eo_bill.InsertOnSubmit(bill);
                db.Sale_eo_bill_detail.InsertAllOnSubmit(bill.Sale_eo_bill_detail);
                db.SubmitChanges();
            }
            catch (Exception ex) {
                return(ex.Message);
            }
            return("");
        }
コード例 #24
0
ファイル: ArmUI.cs プロジェクト: DarthHA/NPCAttacker
 // Update is called on a UIState while it is the active state of the UserInterface.
 // We use Update to handle automatically closing our UI when the player is no longer talking to our Example Person NPC.
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     if (Main.LocalPlayer.talkNPC == -1)
     {
         CloseUI();
     }
     else
     {
         NPC TalkNPC = Main.npc[Main.LocalPlayer.talkNPC];
         TalkNPC.GetGlobalNPC <ArmedGNPC>().Weapon = SomeUtils.CloneItem(_vanillaItemSlot.Item);
     }
 }
コード例 #25
0
ファイル: ArmedGNPC.cs プロジェクト: DarthHA/NPCAttacker
 public override void DrawTownAttackSwing(NPC npc, ref Texture2D item, ref int itemSize, ref float scale, ref Vector2 offset)
 {
     if (!SomeUtils.BuffNPC())
     {
         return;
     }
     if (Weapon.IsAir)
     {
         return;
     }
     item  = Main.itemTexture[Weapon.type];
     scale = Weapon.scale;
 }
コード例 #26
0
ファイル: ArmedGNPC.cs プロジェクト: DarthHA/NPCAttacker
 public override void AI(NPC npc)
 {
     if (!SomeUtils.BuffNPC())
     {
         return;
     }
     if (npc.townNPC && NPCID.Sets.AttackType[npc.type] == 3)
     {
         if (npc.ai[0] != NPCOverrideAI.MeleeAtk)
         {
             MeleeAttacked = false;
         }
     }
 }
コード例 #27
0
ファイル: StarfuryProj.cs プロジェクト: DarthHA/NPCAttacker
        public override void AttackEffect()
        {
            Vector2 Pos = projectile.Center + new Vector2(Math.Sign(projectile.velocity.X) * 40, 0);

            if (SomeUtils.AttackMode())
            {
                Pos = Main.MouseWorld;
            }
            Vector2 ShootPos = new Vector2(projectile.Center.X + (float)Main.rand.Next(201) * -Math.Sign(projectile.velocity.X) + (Pos.X - projectile.Center.X), projectile.Center.Y - 600f);
            int     protmp   = Projectile.NewProjectile(ShootPos, Vector2.Normalize(Pos - ShootPos) * projectile.velocity.Length(), ProjectileID.Starfury, projectile.damage * 2, 0, projectile.owner);

            Main.projectile[protmp].npcProj              = true;
            Main.projectile[protmp].noDropItem           = true;
            Main.projectile[protmp].usesLocalNPCImmunity = true;
            Main.projectile[protmp].localNPCHitCooldown  = 10;
        }
コード例 #28
0
        public JsonResult ResetPassword(int userId)
        {
            string result = new UserSv().ResetPassword(userId, SomeUtils.getMD5("000000"));

            if (!string.IsNullOrEmpty(result))
            {
                return(Json(new ResultModel()
                {
                    suc = false, msg = result
                }));
            }
            return(Json(new ResultModel()
            {
                suc = true
            }));
        }
コード例 #29
0
ファイル: ApplySv.cs プロジェクト: liyihan20/Ele_Sale
        /// <summary>
        /// (有参)发送审批通知到下一个审批人
        /// </summary>
        /// <param name="ap"></param>
        /// <param name="nextStep">下一步骤</param>
        /// <returns></returns>
        private bool SendEmailToNextAuditor(int nextStep)
        {
            string emailTemplate    = @"
                <div>你好:</div>
                <div style='margin-left:30px;'>
                    <div>你有一张待审核的流水号为{0}的单据,请尽快处理。</div>
                    <table style='width:400px;font-size:14px;' border='0' cellpadding='0' cellspacing='3'>
                        <tr><td style='width:100px'>公司:</td><td style='width:300px'>{1}</td></tr>
                        <tr><td>申请人:</td><td>{2}</td></tr>
                        <tr><td>办事处:</td><td>{3}</td></tr>
                        <tr><td>单据类型:</td><td>{4}</td></tr>
                        <tr><td>规格型号:</td><td>{5}</td></tr>
                        <tr><td>审核步骤:</td><td>{6}</td></tr>
                    </table>
                    <br />
                    <div>单击以下链接可进入系统审核这张单据。</div>
                    <div><a href='{7}{8}{9}{10}{11}'>内网用户点击此链接</a></div>
                    <div><a href='{12}{8}{9}{10}{11}'>外网用户点击此链接</a></div>
                </div>
            ";
            var    ads              = ap.ApplyDetails.Where(a => a.pass != null);
            var    auditorsEmailArr = ap.ApplyDetails.Where(a => a.step == nextStep).Select(a => a.User.email).ToArray();
            string emailAddrs       = string.Join(",", auditorsEmailArr);
            BillSv bs           = (BillSv) new BillUtils().GetBillSvInstanceBySysNo(ap.sys_no);
            string billType     = bs.GetSpecificBillTypeName();
            string stepName     = ap.ApplyDetails.Where(a => a.step == nextStep).First().step_name;
            string depName      = new UA((int)ap.user_id).GetUserDepartmentName();
            string returnUrl    = SomeUtils.MyUrlEncoder("Audit/BeginAudit?step=" + nextStep + "&applyId=" + ap.id);
            string emailContent = string.Format(
                emailTemplate,
                ap.sys_no,
                COP_NAME,
                ap.User.real_name,
                depName,
                billType,
                ap.p_model,
                stepName,
                WEB_ADDRESS,
                URL_PREFIX,
                returnUrl,
                ACCOUNT_PARAM,
                IS_INNER_FRAME,
                OUT_ADDRESS
                );

            return(new EmailUtil().SendEmail(emailContent, emailAddrs, null, billType + "审批"));
        }
コード例 #30
0
 public override void AttackEffect()
 {
     if (HasValidTarget())
     {
         Item item = new Item();
         item.SetDefaults(ItemID.DaedalusStormbow);
         int num75 = SomeUtils.PickAmmo(item);
         if (num75 == 0)
         {
             return;
         }
         int num90 = 3;
         if (Main.rand.Next(3) == 0)
         {
             num90++;
         }
         for (int num91 = 0; num91 < num90; num91++)
         {
             Vector2 vector2 = new Vector2(projectile.Center.X + (float)Main.rand.Next(201) * -Math.Sign(projectile.velocity.X) + (GetTargetPos().X - projectile.Center.X), projectile.Center.Y - 600f);
             vector2.X  = (vector2.X * 10f + projectile.Center.X) / 11f + Main.rand.Next(-100, 101);
             vector2.Y -= 150 * num91;
             float num82 = GetTargetPos().X - vector2.X;
             float num83 = GetTargetPos().Y - vector2.Y;
             if (num83 < 0f)
             {
                 num83 *= -1f;
             }
             if (num83 < 20f)
             {
                 num83 = 20f;
             }
             float num84 = (float)Math.Sqrt(num82 * num82 + num83 * num83);
             num84  = projectile.velocity.Length() / num84;
             num82 *= num84;
             num83 *= num84;
             float num92  = num82 + Main.rand.Next(-40, 41) * 0.03f;
             float speedY = num83 + Main.rand.Next(-40, 41) * 0.03f;
             num92     *= Main.rand.Next(75, 150) * 0.01f;
             vector2.X += Main.rand.Next(-50, 51);
             int protmp = Projectile.NewProjectile(vector2.X, vector2.Y, num92, speedY, num75, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
             Main.projectile[protmp].npcProj              = true;
             Main.projectile[protmp].noDropItem           = true;
             Main.projectile[protmp].usesLocalNPCImmunity = true;
             Main.projectile[protmp].localNPCHitCooldown  = 10;
         }
     }
 }