public uint Execute(PacketDistributed ipacket)
        {
            GC_COMPLETEMISSION_RET packet = (GC_COMPLETEMISSION_RET )ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            //enter your logic
            int nMissionID = packet.MissionID;
            int nRet       = packet.Ret;

            if (1 == nRet)
            {
                GameManager.gameManager.MissionManager.CompleteMissionOver(nMissionID);
                if (MissionLogLogic.Instance() != null)
                {
                    MissionLogLogic.Instance().DailyMissionRedPoint();
                }
                if (NewFunctionLogic.Instance() != null)
                {
                    NewFunctionLogic.Instance().DailyMissionRedPoint();
                }
            }
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Example #2
0
        protected void MissionLog_Load(object sender, EventArgs e)
        {
            IList <MissionLog> misLog = MissionLogLogic.Get(CurrentUser.Entity().UserID);
            DataTable          dt     = new DataTable();

            dt.Columns.Add("Mission Name", typeof(string));
            dt.Columns.Add("Successful", typeof(bool));
            dt.Columns.Add("Time of Event", typeof(DateTime));
            dt.Columns.Add("Rewards", typeof(string));

            if (misLog.Count != 0)
            {
                foreach (var mlog in misLog)
                {
                    dt.Rows.Add(mlog.MissionName, mlog.Successful, mlog.Timestamp, ReturnReward(MissionLogLogic.DeserializeRewards(mlog.Rewards)));
                }
                MissionLog.DataSource = dt;
                MissionLog.DataBind();
            }
            else
            {
                MissionLog.DataSource = null;
                MissionLog.DataBind();
            }
        }
 void OnLoadMissionAndMissionDayRoot(bool bSuccess, object param)
 {
     if (MissionLogLogic.Instance() != null)
     {
         MissionLogLogic.Instance().SetOpenTabName("Btn0-CanAccept");
     }
 }
Example #4
0
 void OnLoadMissionAndMissionDayRoot(bool bSuccess, object param)
 {
     if (MissionLogLogic.Instance() != null)
     {
         MissionLogLogic.Instance().tabController.ChangeTab("Btn2-Daily");
     }
 }
        public void HandlePacket(GC_ASK_ACTIVENESSAWARD_RET packet)
        {
            int  nTurnID = packet.Turnid;
            bool bFlag   = (packet.Flag == 0? false:true);

            SetActivenessFlag(nTurnID, bFlag);

            // 通知UI更新
//             if (ActivityController.Instance())
//             {
//                 ActivityController.Instance().UpdateAwardItemState(nTurnID);
//                 ActivityController.Instance().UpdateTabTips();
//             }
            if (FunctionButtonLogic.Instance())
            {
                FunctionButtonLogic.Instance().UpdateActionButtonTip();
            }
            if (MissionLogLogic.Instance())
            {
                MissionLogLogic.Instance().dailyView.UpdateChests(m_nActiveness);
                MissionLogLogic.Instance().DailyMissionRedPoint();
            }
        }
Example #6
0
        protected void StealLinkBtn_Command(object sender, CommandEventArgs e)
        {
            MissionData mis = (MissionData)Session["MissionData"];

            string stolenFile = e.CommandArgument.ToString();

            if (mis.MissionType == 0)
            {
                if (MissionLogic.CheckStolenFile(stolenFile))
                {
                    // Title
                    SummaryTitle.Text      = "Congratulations, Mission Completed!";
                    SummaryTitle.ForeColor = System.Drawing.Color.Green;
                    // Summary
                    MisNameLbl.Text    = mis.MissionName;
                    MisIPLbl.Text      = mis.MissionIP;
                    MisSumLbl.Text     = "Some perpetrators uses these methods to gain access to companies to actually steal theri client information. As such, this could be prevented if firewall rules and other configurations were set up correctly.";
                    MisExpLbl.Text     = mis.MissionExp.ToString();
                    MisCoinLbl.Text    = mis.MissionCoin.ToString();
                    Step5Lbl.ForeColor = System.Drawing.Color.Green;


                    using (DataContext db = new DataContext())
                    {
                        Users u = CurrentUser.Entity(false, db);
                        u.TotalExp = u.TotalExp + mis.MissionExp;

                        Items i = ItemLogic.GetRewardForMis(mis.RecommendLevel, Machines.GetUserMachine(CurrentUser.Entity().UserID, db));
                        ItemNameLbl.Text   = i.ItemName;
                        ItemBonusLbl.Text  = i.ItemBonus.ToString();
                        ItemImage.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(i.ItemPic, 0, i.ItemPic.Length);

                        InventoryItem invItem;
                        if (ItemLogic.CheckInventoryItem(db, u.UserID, i.ItemId, out invItem))
                        {
                            invItem.Quantity += 1;
                            db.SaveChanges();
                        }
                        else
                        {
                            invItem          = new InventoryItem();
                            invItem.UserId   = u.UserID;
                            invItem.ItemId   = i.ItemId;
                            invItem.Quantity = 1;
                            db.InventoryItem.Add(invItem);
                        }
                        List <string> RewardList = new List <string>();
                        RewardList.Add("Mission Exp: " + mis.MissionExp.ToString());
                        RewardList.Add("Mission Coin: " + mis.MissionCoin.ToString());
                        RewardList.Add("Item: " + i.ItemName);

                        MissionLogLogic.Store(CurrentUser.Entity().UserID, mis.MissionName, true, RewardList);
                    }

                    ScriptManager.RegisterStartupScript(this, this.GetType(), "missionSumModel", "showFinishPrompt();", true);
                }
                else
                {
                    // Title
                    SummaryTitle.Text      = "Mission Failed!";
                    SummaryTitle.ForeColor = System.Drawing.Color.Red;
                    MisNameLbl.Text        = mis.MissionName;
                    MisIPLbl.Text          = mis.MissionIP;
                    MisSumLbl.Text         = "Mission Failed due to incorrect file choosen.";
                    MisExpLbl.Text         = "0";
                    MisCoinLbl.Text        = "0";
                    Step5Lbl.ForeColor     = System.Drawing.Color.Red;
                    ItemImage.Visible      = false;
                    List <string> rewardList = new List <string>();
                    rewardList.Add("Failed Mission no reward");
                    MissionLogLogic.Store(CurrentUser.Entity().UserID, mis.MissionName, false, rewardList);

                    ScriptManager.RegisterStartupScript(this, this.GetType(), "missionSumModel", "showFinishPrompt();", true);
                }
            }
            else
            {
                // Title
                SummaryTitle.Text      = "Mission Failed!";
                SummaryTitle.ForeColor = System.Drawing.Color.Red;
                MisNameLbl.Text        = mis.MissionName;
                MisIPLbl.Text          = mis.MissionIP;
                MisSumLbl.Text         = "Mission Failed due to incorrect type of attack choosen";
                MisExpLbl.Text         = "0";
                MisCoinLbl.Text        = "0";
                Step5Lbl.ForeColor     = System.Drawing.Color.Red;
                ItemImage.Visible      = false;
                List <string> rewardList = new List <string>();
                rewardList.Add("Failed Mission no reward");
                MissionLogLogic.Store(CurrentUser.Entity().UserID, mis.MissionName, false, rewardList);


                ScriptManager.RegisterStartupScript(this, this.GetType(), "missionSumModel", "showFinishPrompt();", true);
            }
        }
Example #7
0
//  void OnEnable ()
//  {
//      Messenger.AddListener (MessengerConst.OnMissionStateChanged, OnMissionStateChanged);
//  }
//
//  void OnDisable ()
//  {
//      Messenger.RemoveListener (MessengerConst.OnMissionStateChanged, OnMissionStateChanged);
//  }

    void OnDestroy()
    {
        m_Instance = null;
    }
Example #8
0
 void Awake()
 {
     m_Instance = this;
 }
Example #9
0
        protected void LoginBtn_Click(object sender, EventArgs e)
        {
            MissionData mis = Session["MissionData"] as MissionData;

            if (mis.MissionType == (MissionType)3)
            {
                if (UsrName.Text.Equals("adminbypass-'*/--") && Password.Text.Equals("' DROP ALL TABLES;--"))
                {
                    // Title
                    SummaryTitle.Text      = "Congratulations, Mission Completed!";
                    SummaryTitle.ForeColor = System.Drawing.Color.Green;
                    // Summary
                    MisNameLbl.Text = mis.MissionName;
                    MisIPLbl.Text   = mis.MissionIP;
                    MisSumLbl.Text  = "Congrats on compleeting the mission.";
                    MisExpLbl.Text  = mis.MissionExp.ToString();
                    MisCoinLbl.Text = mis.MissionCoin.ToString();

                    using (DataContext db = new DataContext())
                    {
                        Users u = CurrentUser.Entity(false, db);
                        u.TotalExp = u.TotalExp + mis.MissionExp;

                        Items i = ItemLogic.GetRewardForMis(mis.RecommendLevel, Machines.GetUserMachine(CurrentUser.Entity().UserID, db));
                        ItemNameLbl.Text   = i.ItemName;
                        ItemBonusLbl.Text  = i.ItemBonus.ToString();
                        ItemImage.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(i.ItemPic, 0, i.ItemPic.Length);

                        Step4lbl.ForeColor = System.Drawing.Color.Green;

                        InventoryItem invItem;

                        if (ItemLogic.CheckInventoryItem(db, u.UserID, i.ItemId, out invItem))
                        {
                            invItem.Quantity += 1;
                            db.SaveChanges();
                        }
                        else
                        {
                            invItem          = new InventoryItem();
                            invItem.UserId   = u.UserID;
                            invItem.ItemId   = i.ItemId;
                            invItem.Quantity = 1;
                            db.InventoryItem.Add(invItem);
                        }

                        db.SaveChanges();

                        List <string> RewardList = new List <string>();
                        RewardList.Add("Mission Exp: " + mis.MissionExp.ToString());
                        RewardList.Add("Mission Coin: " + mis.MissionCoin.ToString());
                        RewardList.Add("Item: " + i.ItemName);
                        MissionLogLogic.Store(CurrentUser.Entity().UserID, mis.MissionName, true, RewardList);
                    }

                    ScriptManager.RegisterStartupScript(this, this.GetType(), "missionSumModel", "showFinishPrompt();", true);
                }
                else
                {
                    // Title
                    SummaryTitle.Text      = "Mission Failed!";
                    SummaryTitle.ForeColor = System.Drawing.Color.Red;
                    // Summary
                    MisNameLbl.Text   = mis.MissionName;
                    MisIPLbl.Text     = mis.MissionIP;
                    MisSumLbl.Text    = "Mission Failed due to incorrect SQL Inection code choosen";
                    MisExpLbl.Text    = "0";
                    MisCoinLbl.Text   = "0";
                    ItemImage.Visible = false;

                    List <string> rewardList = new List <string>();
                    rewardList.Add("Failed Mission no reward");
                    MissionLogLogic.Store(CurrentUser.Entity().UserID, mis.MissionName, false, rewardList);
                }
            }
            else
            {
                // Title
                SummaryTitle.Text      = "Mission Failed!";
                SummaryTitle.ForeColor = System.Drawing.Color.Red;
                MisNameLbl.Text        = mis.MissionName;
                MisIPLbl.Text          = mis.MissionIP;
                MisSumLbl.Text         = "Mission Failed due to incorrect type of attack choosen";
                MisExpLbl.Text         = "0";
                MisCoinLbl.Text        = "0";
                ItemImage.Visible      = false;
                List <string> rewardList = new List <string>();
                rewardList.Add("Failed Mission no reward");
                MissionLogLogic.Store(CurrentUser.Entity().UserID, mis.MissionName, false, rewardList);
            }
        }