From c12d5449fea4d565592bda07cbac539f370d7d46 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 23 十月 2020 17:12:15 +0800
Subject: [PATCH] 8440 【道具】VIP15直升卡(同步主干;支持领取默认直接使用);

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerVip.py            |   16 +++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py          |   13 ++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_VIPLVCard.py |   44 ++++++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py                 |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                    |    1 
 5 files changed, 74 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 33db31f..70203af 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -456,6 +456,7 @@
 Def_Effect_TouchMission = 252 #触发任务
 Def_Effect_HorsePetSkinExp = 253 #骑宠觉醒值
 Def_Effect_ItemGiveTreasureScore = 254      #使用道具给予寻宝积分
+Def_Effect_VIPLVCard = 256    #VIP等级直升卡 直接升到VIPx级,只加经验,享受VIP特权    效果值A: vip等级    效果值B: 领取是否默认直接使用
 #----以下未使用或代码依然存在的---
 Def_Effect_ItemGiveGongXun = 1920        #使用道具给予功勋
 Def_Effect_ItemGiveRuneJH = 1925       #使用道具给予符印精华
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
index 41e427b..92e34b2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
@@ -721,6 +721,7 @@
                             ChConfig.Def_Effect_CleanGuilt:"Item_CleanGuilt", # 洗红名
                             ChConfig.Def_Effect_PrizeCoin:"Item_PrizeCoin", # 奖励充值点券
                             ChConfig.Def_Effect_AddVIPExp:"Item_AddVIPExp", # 增加VIP经验
+                            ChConfig.Def_Effect_VIPLVCard:"Item_VIPLVCard", # VIP等级直升卡
                             ChConfig.Def_Effect_ResetBossKillCnt:"Item_ResetBossKillCnt", # 重置boss击杀疲劳
                             ChConfig.Def_Effect_AddFBCnt:"Item_AddFBCnt", # 增加副本可进入次数
                             ChConfig.Def_Effect_AddKillBossCnt:"Item_AddKillBossCnt", # 增加BOSS可击杀次数
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
index 1c341a0..09285d9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -35,6 +35,7 @@
 import IpyGameDataPY
 import DataRecordPack
 import EventShell
+import PlayerVip
 import ChEquip
 
 import math
@@ -1091,6 +1092,18 @@
             PlayerMagicWeapon.DoActiveMW(curPlayer, tagItem.GetEffectByIndex(0).GetEffectValue(0))
             tagItem.Clear()
             return True
+        itemEff = tagItem.GetEffectByIndex(0)
+        #直升VIP
+        if itemEff.GetEffectID() == ChConfig.Def_Effect_VIPLVCard:
+            isAutoUse = itemEff.GetEffectValue(1)
+            if isAutoUse:
+                tagVIPLV = itemEff.GetEffectValue(0)
+                isOK, _ = PlayerVip.UpgradeVIPLV(curPlayer, tagVIPLV)
+                if isOK:
+                    #GameWorld.DebugLog("直升VIP默认使用")
+                    tagItem.Clear()
+                    return True
+                
         if itemID in ChConfig.Def_TransformItemIDList:
             # 直接转化为对应货币的物品仅在放入背包时直接转化,否则还是以真实物品的形式存在,但堆叠上限需要做特殊处理
             if packIndex == IPY_GameWorld.rptItem:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_VIPLVCard.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_VIPLVCard.py
new file mode 100644
index 0000000..3c4cf8e
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_VIPLVCard.py
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package UseItem.Item_VIPLVCard
+#
+# @todo:VIP等级直升卡
+# @author hxp
+# @date 2020-9-3
+# @version 1.0
+#
+# 详细描述: VIP等级直升卡  直接升到VIPx级,只加经验,享受VIP特权
+#
+# 效果值A: vip等级   
+# 效果值B: 领取是否默认直接使用
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2020-09-03 18:30"""
+#-------------------------------------------------------------------------------
+
+import PlayerVip
+import ItemCommon
+import ChConfig
+
+def BatchUseItem(curPlayer, curRoleItem, tick, useCnt, exData):
+    ##批量使用物品
+    curEff = curRoleItem.GetEffectByIndex(0)
+    tagVIPLV = curEff.GetEffectValue(0)
+    befVIPLV = curPlayer.GetVIPLv()
+    befVIPExp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_VipExp)
+    
+    isOK, addExp = PlayerVip.UpgradeVIPLV(curPlayer, tagVIPLV)
+    if not isOK:
+        return
+    
+    succCnt = 1 # 默认值使用1个
+    aftVIPLV = curPlayer.GetVIPLv()
+    aftVIPExp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_VipExp)
+    saveDataDict = {"BeforeVIPLV":befVIPLV, "BeforeVIPExp":befVIPExp, "AfterVIPLV":aftVIPLV, "AfterVIPExp":aftVIPExp, "AddVIPExp":addExp}
+    ItemCommon.DelItem(curPlayer, curRoleItem, succCnt, True, ChConfig.ItemDel_AddVIPExp, saveDataDict, True)
+    return True, succCnt
+    
+    
+
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerVip.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerVip.py
index 89e8191..6444c8a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerVip.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerVip.py
@@ -251,6 +251,20 @@
     newStrTick = tickList[0] + ' ' + '00:00:00'
     return GameWorld.ChangeTimeStrToNum(newStrTick)
 
+## 直升VIP等级
+def UpgradeVIPLV(curPlayer, tagVIPLV):
+    befVIPLV = curPlayer.GetVIPLv()
+    if befVIPLV >= tagVIPLV:
+        GameWorld.DebugLog("已经达到该VIP等级!不需要处理")
+        return True, 0
+    vipExpDict = GetVIPLvUpExp()
+    if tagVIPLV not in vipExpDict:
+        GameWorld.ErrLog("没有该VIP等级,无法直升! tagVIPLV=", tagVIPLV);
+        return False, 0
+    tagVIPExp = vipExpDict[tagVIPLV]    
+    vipExp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_VipExp)
+    addExp = tagVIPExp - vipExp
+    return AddVIPExp(curPlayer, addExp), addExp
      
 #VIP经验增加入口 
 def AddVIPExp(curPlayer, exp):
@@ -270,7 +284,7 @@
         OnChangeVIPLv(curPlayer, vipLV) ##当VIP等级变更,触发的方法写在这里
         PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_VIPLV, 1, [vipLV])
         vipLV += 1
-    GameWorld.DebugLog("VIP等级--%s,经验--%s" % (curPlayer.GetVIPLv(), vipExp))
+    GameWorld.DebugLog("VIP等级--%s,addExp--%s,经验--%s" % (curPlayer.GetVIPLv(), exp, vipExp))
     Sycn_VIPMsg(curPlayer)
     if not preVIPLV:
         Sycn_VIPTime(curPlayer)

--
Gitblit v1.8.0