Esempio n. 1
0
        void OnPlayerSettingsChanged(CEventBaseArgs data)
        {
            bool isSettingHookChanged = false;

            foreach (PkgPlayerPersonality settingInfo in GlobalSettings.Instance.PlayerSettings)
            {
                switch (settingInfo.type)
                {
                case GameConst.SETTING_KEY_HOOK_USE_HP_DRUG_HP_RATIO:
                {
                    mUseHPDrugHPRatio    = (float)(settingInfo.value) / 100f;
                    isSettingHookChanged = true;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_USE_MP_DRUG_MP_RATIO:
                {
                    mUseMPDrugMPRatio    = (float)(settingInfo.value) / 100f;
                    isSettingHookChanged = true;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_RANGE_TYPE:
                {
                    mRangeType           = (EHookRangeType)settingInfo.value;
                    isSettingHookChanged = true;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_BUY_DRUG:
                {
                    mAutoBuyDrug         = settingInfo.value == 0 ? false : true;
                    isSettingHookChanged = true;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_SWALLOW:
                {
                    mAutoSwallow         = settingInfo.value == 0 ? false : true;
                    isSettingHookChanged = true;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_REVIVE:
                {
                    mAutoRevive          = settingInfo.value == 0 ? false : true;
                    isSettingHookChanged = true;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_SELL_GOODS:
                {
                    mAutoSellGoods       = settingInfo.value == 0 ? false : true;
                    isSettingHookChanged = true;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_PICK_DROP_PREFIX:
                {
                    mAutoPickDrop        = settingInfo.value == 0 ? false : true;
                    isSettingHookChanged = true;
                    break;
                }

                default:
                    break;
                }

                HookGoodsSettingInfo hookGoodsSettingInfo = null;
                int hookGoodsSettingInfoId = (int)(settingInfo.type) - (int)(GameConst.SETTING_KEY_HOOK_AUTO_PICK_DROP_PREFIX);
                if (hookGoodsSettingInfoId > 0)
                {
                    if (mAutoPickDropInfos.TryGetValue((uint)(hookGoodsSettingInfoId), out hookGoodsSettingInfo) == true && hookGoodsSettingInfo != null)
                    {
                        SetAutoPickDrop((uint)(hookGoodsSettingInfoId), settingInfo.value == 0 ? false : true);
                        isSettingHookChanged = true;
                    }
                }
            }

            if (isSettingHookChanged == true)
            {
                ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_SETTING_HOOK_CHANGED, null);
            }
        }
Esempio n. 2
0
        public void Reset()
        {
            foreach (Dictionary <string, string> row in DBManager.Instance.QuerySqliteTable <string>(GlobalConfig.DBFile, "data_persional_default"))
            {
                uint id = 0;
                uint.TryParse(row["id"], out id);
                uint defaultValue = 0;
                uint.TryParse(row["default"], out defaultValue);
                switch (id)
                {
                case GameConst.SETTING_KEY_HOOK_USE_HP_DRUG_HP_RATIO:
                {
                    mUseHPDrugHPRatio = ((float)defaultValue) / 100f;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_USE_MP_DRUG_MP_RATIO:
                {
                    mUseMPDrugMPRatio = ((float)defaultValue) / 100f;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_RANGE_TYPE:
                {
                    mRangeType = (EHookRangeType)defaultValue;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_BUY_DRUG:
                {
                    mAutoBuyDrug = (defaultValue > 0) ? true : false;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_SWALLOW:
                {
                    mAutoSwallow = (defaultValue > 0) ? true : false;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_REVIVE:
                {
                    mAutoRevive = (defaultValue > 0) ? true : false;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_SELL_GOODS:
                {
                    mAutoSellGoods = (defaultValue > 0) ? true : false;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_PICK_DROP_PREFIX:
                {
                    mAutoPickDrop = (defaultValue > 0) ? true : false;
                    break;
                }

                default:
                    break;
                }
            }

            mAutoBuyHPDrugGoodsId   = 0;
            mAutoBuyHPDrugMoneyType = 0;
            mAutoBuyHPDrugPrice     = 0;
            mAutoBuyMPDrugGoodsId   = 0;
            mAutoBuyMPDrugMoneyType = 0;
            mAutoBuyMPDrugPrice     = 0;

            mIsBuyingDrug   = false;
            mIsSellingGoods = false;
            mIsUsingHPDrug  = false;
            mIsUsingMPDrug  = false;

            if (mTimer != null)
            {
                mTimer.Destroy();
                mTimer = null;
            }
            mTimer = new Utils.Timer(5000, true, Mathf.Infinity, UpdateTimer);

            mUseHPDrugGoodsIds = GameConstHelper.GetUintList("GAME_HOOK_USE_HP_DRUG_GOODS_ID");
            mUseMPDrugGoodsIds = GameConstHelper.GetUintList("GAME_HOOK_USE_MP_DRUG_GOODS_ID");
            mAutoBuyHPDrugNum  = GameConstHelper.GetUint("GAME_HOOK_BUY_HP_DRUG_NUM");
            mAutoBuyMPDrugNum  = GameConstHelper.GetUint("GAME_HOOK_BUY_MP_DRUG_NUM");
        }