public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var achievementId   = trigger.Text.NextUInt(0u);
                var achivementEntry = AchievementMgr.GetAchievementEntry(achievementId);

                if (achivementEntry != null)
                {
                    AddAchievement((Character)trigger.Args.Target, achievementId);
                    trigger.Reply("Achievement \"{0}\" added sucessfully.", achivementEntry.Names);
                }
                else
                {
                    trigger.Reply("Invalid AchievementId");
                    return;
                }
            }
Beispiel #2
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                uint             achievementEntryId = trigger.Text.NextUInt(0U);
                AchievementEntry achievementEntry   = AchievementMgr.GetAchievementEntry(achievementEntryId);

                if (achievementEntry != null)
                {
                    AchievementCommands.AddAchievementCommand.AddAchievement((Character)trigger.Args.Target,
                                                                             achievementEntryId);
                    trigger.Reply("Achievement \"{0}\" added sucessfully.", (object[])achievementEntry.Names);
                }
                else
                {
                    trigger.Reply("Invalid AchievementId");
                }
            }
Beispiel #3
0
    void initItems()
    {
        var temp = AchievementMgr.getCurAchievementMgr().getSortList();

        for (int i = 0; i < temp.Count; i++)
        {
            if (temp[i].compliteday != -1)
            {
                var item = Instantiate(_acievenItemObject);
                item.transform.SetParent(_showItemLayer.transform);
                item.transform.localScale = new Vector3(1f, 1f, 1f);

                var itemsprite = item.transform.GetChild(0).gameObject.GetComponent <Image>();
                itemsprite.sprite = Resources.Load <Sprite>("ui/achieve/achieve_name_" + temp[i].id);
                itemsprite.SetNativeSize();
            }
        }
    }
Beispiel #4
0
        public bool CanCompleted(AchievementInfo achievementInfo)
        {
            int count = 0;
            List <AchievementConditionInfo> conditions = AchievementMgr.GetAchievementCondition(achievementInfo);

            if (conditions != null && conditions.Count > 0)
            {
                foreach (AchievementConditionInfo condition in conditions)
                {
                    foreach (UsersRecordInfo userRecord in this.m_userRecord)
                    {
                        if (condition.CondictionType == userRecord.RecordID)
                        {
                            if (condition.Condiction_Para2 <= userRecord.Total)
                            {
                                count++;
                            }
                        }
                    }
                }
            }
            return(count == conditions.Count);
        }
Beispiel #5
0
    public void RemoveWrongSelect()
    {
        if (_wrongSeletIdxArr.Count == 0)
        {
            return;
        }

        int idx       = Random.Range(0, _wrongSeletIdxArr.Count);
        int removeidx = _wrongSeletIdxArr[idx];

        _wrongSeletIdxArr.RemoveAt(idx);

        var line = Instantiate(_removeSelectLineObject);

        line.transform.SetParent(questionText.transform.parent);
        line.transform.localScale    = new Vector3(1f, 1f, 1f);
        line.transform.localPosition = answers[removeidx].transform.localPosition + new Vector3(-270f, 0f, 0f);
        _lineObjects.Add(line);

        (answers[removeidx]).raycastTarget = false;

        AchievementMgr.getCurAchievementMgr().addAchievementNum(AchievementType.ACHIEVE_REMIND_TIME, 1);
    }
Beispiel #6
0
        public bool SendReward(AchievementInfo achievementInfo)
        {
            string msg = "";
            List <AchievementRewardInfo> rewards = AchievementMgr.GetAchievementReward(achievementInfo);
            List <ItemInfo> mainBg = new List <ItemInfo>();
            List <ItemInfo> propBg = new List <ItemInfo>();
            bool            result;

            foreach (AchievementRewardInfo reward in rewards)
            {
                if (reward.RewardType == 3)
                {
                    ItemTemplateInfo temp = ItemMgr.FindItemTemplate(reward.RewardValueId);
                    if (temp != null)
                    {
                        int NeedSex = this.m_player.PlayerCharacter.Sex ? 1 : 2;
                        if (temp.NeedSex != 0 && temp.NeedSex != NeedSex)
                        {
                            continue;
                        }
                        int tempCount = reward.RewardCount;
                        msg = msg + LanguageMgr.GetTranslation("Game.Server.Achievement.FinishAchievement.RewardProp", new object[]
                        {
                            temp.Name,
                            reward.RewardCount
                        }) + " ";
                        for (int len = 0; len < tempCount; len += temp.MaxCount)
                        {
                            int      count = (len + temp.MaxCount > tempCount) ? (tempCount - len) : temp.MaxCount;
                            ItemInfo item  = ItemInfo.CreateFromTemplate(temp, count, 120);
                            if (item != null)
                            {
                                string[] para = reward.RewardPara.Split(new char[]
                                {
                                    ','
                                });
                                item.StrengthenLevel = int.Parse(para[0]);
                                item.AttackCompose   = int.Parse(para[1]);
                                item.DefendCompose   = int.Parse(para[2]);
                                item.AgilityCompose  = int.Parse(para[3]);
                                item.LuckCompose     = int.Parse(para[4]);
                                item.ValidDate       = int.Parse(para[5]);
                                item.IsBinds         = (int.Parse(para[6]) != 0);
                                if (temp.BagType == eBageType.PropBag)
                                {
                                    propBg.Add(item);
                                }
                                else
                                {
                                    mainBg.Add(item);
                                }
                            }
                        }
                    }
                    if (mainBg.Count > 0 && this.m_player.MainBag.GetEmptyCount() < mainBg.Count)
                    {
                        this.m_player.Out.SendMessage(eMessageType.ERROR, this.m_player.GetInventoryName(eBageType.MainBag) + LanguageMgr.GetTranslation("Game.Server.Achievement.BagFull", new object[0]) + " ");
                        result = false;
                        return(result);
                    }
                    if (propBg.Count > 0 && this.m_player.PropBag.GetEmptyCount() < propBg.Count)
                    {
                        this.m_player.Out.SendMessage(eMessageType.ERROR, this.m_player.GetInventoryName(eBageType.PropBag) + LanguageMgr.GetTranslation("Game.Server.Achievement.BagFull", new object[0]) + " ");
                        result = false;
                        return(result);
                    }
                    foreach (ItemInfo item in mainBg)
                    {
                        //ItemInfo item;
                        if (!this.m_player.MainBag.StackItemToAnother(item))
                        {
                            this.m_player.MainBag.AddItem(item);
                        }
                    }
                    foreach (ItemInfo item in propBg)
                    {
                        //ItemInfo item;
                        if (!this.m_player.PropBag.StackItemToAnother(item))
                        {
                            this.m_player.PropBag.AddItem(item);
                        }
                    }
                }
            }
            if (achievementInfo.AchievementPoint != 0)
            {
                this.m_player.AddAchievementPoint(achievementInfo.AchievementPoint);
                msg = msg + LanguageMgr.GetTranslation("Game.Server.Achievement.FinishAchievement.AchievementPoint", new object[]
                {
                    achievementInfo.AchievementPoint
                }) + " ";
            }
            result = true;
            return(result);
        }
Beispiel #7
0
        public override bool Start()
        {
            bool result = true;

            try
            {
                IsRunning = 0;
                Thread.CurrentThread.Priority = ThreadPriority.Normal;
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException);


                if (!this.StartScriptComponents())
                {
                    result = false;
                    GameServer.log.Error("初始化脚本失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化脚本成功!");

                if (!this.InitSocket(IPAddress.Parse(this.Config.GameIP), this.Config.GamePort))
                {
                    result = false;
                    GameServer.log.Error("初始化监听端口失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化监听端口成功!");

                if (!this.AllocatePacketBuffers())
                {
                    result = false;
                    GameServer.log.Error("分配数据包缓冲区失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("分配数据包缓冲区成功!");

                //LogMgr.Setup

                if (!WorldMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化世界场景失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化世界场景成功!");



                if (!FusionMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化熔炼失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化熔炼成功!");

                if (!AwardMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化奖励失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化奖励成功!");


                if (!MissionInfoMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化关卡失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化关卡成功!");

                if (!PveInfoMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化pve失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化pve成功!");



                if (!FightRateMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化战斗倍率失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化战斗倍率成功!");

                if (!ConsortiaLevelMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化公会等级失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化公会等级成功!");

                if (!StrengthenMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化强化失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化强化成功!");

                if (!ShopMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化商店失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化商店成功!");

                if (!BoxMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化时间宝箱失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化时间宝箱成功!");

                if (!QuestMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化任务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化任务成功!");

                if (!AchievementMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化成就失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化成就成功!");

                if (!AchievementMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化成就失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化成就成功!");

                if (!RoomMgr.Setup(this.Config.MaxRoomCount))
                {
                    result = false;
                    GameServer.log.Error("初始化房间管理服务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化房间管理服务成功!");

                if (!GameMgr.Setup(1, 4))
                {
                    result = false;
                    GameServer.log.Error("初始化游戏管理服务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化游戏管理服务成功!");

                if (!ConsortiaMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化公会失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化公会成功!");


                if (!Game.Server.Managers.RateMgr.Init(this.Config))
                {
                    result = false;
                    GameServer.log.Error("初始化经验倍率管理服务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化经验倍率管理服务成功!");

                if (!MacroDropMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化宏观掉落失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化宏观掉落成功!");


                if (!BattleMgr.Setup(this.Config))
                {
                    result = false;
                    GameServer.log.Error("加载战斗管理服务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("加载战斗管理服务成功!");

                if (!this.InitGlobalTimer())
                {
                    result = false;
                    GameServer.log.Error("初始化全局Timers失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化全局Timers成功!");

                if (!this.InitLoginServer())
                {
                    result = false;
                    GameServer.log.Error("登陆到中心服务器失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("登陆到中心服务器成功!");

                if (!MarryRoomMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化礼堂失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化礼堂成功!");

                if (!SpaRoomMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化温泉失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化温泉成功!");

                if (!ActiveMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化活动失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化活动成功!");
                if (!VIPMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化VIP失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化VIP成功!");
                if (!LevelMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化等级失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化等级成功!");

                /*  if (!WorldBossMgr.Init())
                 * {
                 *    result = false;
                 *    GameServer.log.Error("初始化世界Boss失败,请检查!");
                 *    return result;
                 * }
                 * GameServer.log.Info("初始化世界Boss成功!");
                 */
                RoomMgr.Start();
                GameMgr.Start();
                BattleMgr.Start();
                MacroDropMgr.Start();

                if (!base.Start())
                {
                    result = false;
                    GameServer.log.Error("启动基础服务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("启动基础服务成功!");

                GameEventMgr.Notify(ScriptEvent.Loaded);
                GC.Collect(GC.MaxGeneration);
                //LogMgr.Setup(1, 1, 1);
                GameServer.log.Warn("游戏服务器启动成功!");
                IsRunning = 1;
            }
            catch (Exception e)
            {
                GameServer.log.Error("Failed to start the server", e);
                // throw e;
                result = false;
            }
            return(result);
        }