xdh
2019-06-10 4dcb18d0e7848effd25e0d5970e9c84808da957c
7155 【后端】【2.0】新增仙盟创建规则
6个文件已修改
1个文件已添加
205 ■■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/DataRecordPack.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerDBGSEvent.py 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_CreateFamilyPayMoney.py 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -2121,6 +2121,58 @@
#------------------------------------------------------
# A4 0D 通知建盟次数 #tagGCServerCreatFamilyTimes
class  tagGCServerCreatFamilyTimes(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("Times", c_int),    #建盟次数
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xA4
        self.SubCmd = 0x0D
        return
    def ReadData(self, stringData, _pos=0, _len=0):
        self.Clear()
        memmove(addressof(self), stringData[_pos:], self.GetLength())
        return _pos + self.GetLength()
    def Clear(self):
        self.Cmd = 0xA4
        self.SubCmd = 0x0D
        self.Times = 0
        return
    def GetLength(self):
        return sizeof(tagGCServerCreatFamilyTimes)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A4 0D 通知建盟次数 //tagGCServerCreatFamilyTimes:
                                Cmd:%s,
                                SubCmd:%s,
                                Times:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.Times
                                )
        return DumpString
m_NAtagGCServerCreatFamilyTimes=tagGCServerCreatFamilyTimes()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCServerCreatFamilyTimes.Cmd,m_NAtagGCServerCreatFamilyTimes.SubCmd))] = m_NAtagGCServerCreatFamilyTimes
#------------------------------------------------------
#A4 01  查看申请入会的玩家信息 #tagGCViewFamilyRequestInfo
class  tagtMemberInfo(Structure):
ServerPython/CoreServerGroup/GameServer/Script/DataRecordPack.py
@@ -116,10 +116,10 @@
#  @param familyName: 家族名
#  @param familyID: 家族ID
#  @return None
def DR_CreateFamily(accID, playerID, playerNaem, familyName, familyID):
def DR_CreateFamily(accID, playerID, playerNaem, familyName, familyID, creatFamilyTimes):
    dataDict = {'AccID':accID, 'PlayerID':playerID, "PlayerName":playerNaem, 'FamilyName':familyName, 
                'FamilyID':familyID}
                'FamilyID':familyID, 'creatFamilyTimes':creatFamilyTimes}
    #发送封包
    SendEventPack("CreateFamily", dataDict)
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerDBGSEvent.py
@@ -134,6 +134,9 @@
# 假仙盟随机编号
Def_FakeFamilyIndex = 'FakeFamilyIndex_%s'  # 参数为第几个假仙盟
# 服务器建盟次数
Def_ServerCreatFamilyTimes = "CreatFamilyTimes"
#设置运营活动ID的标记
Def_OperationActID = 'OperationActID_%s' #参数为运营活动名
#运营活动开启时世界等级,参数为运营活动名
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py
@@ -162,6 +162,28 @@
        NetPackCommon.SendFakePack(curPlayer, fakeFamilyPack)
    return
def SyncCreatFamilyTimes(curPlayer=None):
    # 通知建盟次数
    packData = ChPyNetSendPack.tagGCFakeFamilyInfo()
    packData.Clear()
    packData.Times = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerCreatFamilyTimes)
    if not curPlayer:
        # 全服广播在线玩家
        playerManager = GameWorld.GetPlayerManager()
        for i in range(0, playerManager.GetPlayerCount()):
            curPlayer = playerManager.GetPlayerByIndex(i)
            if curPlayer == None or not curPlayer.GetInitOK():
                continue
            if PlayerControl.GetIsTJG(curPlayer):
                continue
            NetPackCommon.SendFakePack(curPlayer, packData)
    else:
        if PlayerControl.GetIsTJG(curPlayer):
            return
        NetPackCommon.SendFakePack(curPlayer, packData)
    return
#输入家族名称
#class   IPY_CInputFamilyName
#{
@@ -245,11 +267,13 @@
    
    #-设置家族成员属性
    DoPlayerJionFamily(curFamily, curPlayer, IPY_GameServer.fmlLeader)
    creatFamilyTimes = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerCreatFamilyTimes)
    #扣道具(前N个战盟并且假编号在随机编号里不要钱)
    if fakeIndex and fakeIndex in fakeIndexList:
        PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FakeFamilyIndex % fakeIndexList.index(fakeIndex), 0)
        GameWorld.DebugLog('    创建前3个仙盟不扣钱! 假仙盟索引%s'%fakeIndexList.index(fakeIndex))
        GameWorld.Log('    创建前n个假仙盟不扣钱! 假仙盟索引%s'%fakeIndexList.index(fakeIndex))
    elif creatFamilyTimes < IpyGameDataPY.GetFuncCfg('CreateFamilyNeedMoney', 3):
        GameWorld.Log('    创建前n个仙盟不扣钱! creatFamilyTimes=%s' % creatFamilyTimes)
    else:
        for i, findex in enumerate(fakeIndexList):
            if findex:
@@ -259,7 +283,9 @@
        needMoney = IpyGameDataPY.GetFuncCfg('CreateFamilyNeedMoney')
        if needMoney:
            moneyType = IpyGameDataPY.GetFuncCfg('CreateFamilyNeedMoney', 2)
            curPlayer.MapServer_PayMoney(moneyType, needMoney)
            sendMsg = str([moneyType, needMoney])
            curPlayer.MapServer_QueryPlayerResult(0, 0, "CreateFamilyPayMoney", sendMsg, len(sendMsg))
            #curPlayer.MapServer_PayMoney(moneyType, needMoney)
            #玩家创建家族费用转化为家族初始资金
            #PlayerAddFamilyMoney(curPlayer, curFamily, needMoney)
  
@@ -285,12 +311,13 @@
    
    #XW_JZ_EstablishSud <n color="255,255,0">恭喜您,家族建立成功!</n>    25  -   -
    PlayerControl.NotifyCode(curPlayer, "XW_JZ_EstablishSud")
    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerCreatFamilyTimes, min(creatFamilyTimes + 1, ShareDefine.Def_UpperLimit_DWord))
    SyncCreatFamilyTimes()
    #帮会创建流向
    DataRecordPack.DR_CreateFamily(curPlayer.GetAccID(), curPlayerID, curPlayer.GetName(),
                                   fullFamilyName, curFamily.GetID())
                                   fullFamilyName, curFamily.GetID(), creatFamilyTimes+1)
    GameWorld.Log('创建家族 : %s(%s), fakeIndex=%s' % (fullFamilyName, curFamily.GetID(), fakeIndex), curPlayerID)
    GameWorld.Log('创建家族 : %s(%s), fakeIndex=%s, creatFamilyTimes=%s' % (fullFamilyName, curFamily.GetID(), fakeIndex, creatFamilyTimes+1), curPlayerID)
    PlayerControl.WorldNotify(0, "jiazu_liubo_671654", [curPlayer.GetName(), fullFamilyName, curFamily.GetID()])
    return
@@ -1874,6 +1901,7 @@
#  @remarks 函数详细说明.
def PlayerLoginRefreshFamily(curPlayer, tick):
    SyncFakeFamilyInfo(curPlayer)
    SyncCreatFamilyTimes(curPlayer)
    familyID = curPlayer.GetFamilyID()
    curFamily = None
    
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4607,6 +4607,7 @@
Def_Cost_AuctionBid, # 拍卖行竞价
Def_Cost_BuyDailyActionCnt, # 购买活动次数
Def_Cost_FBBuyBuff, # 副本买buff
Def_Cost_CreatFamily, # 创建仙盟
#-----------以下为暂时没用的,先不删除,如有新增消费点则放在这些之前------------
Def_Cost_RefreshArrestTask, # 刷新悬赏任务
Def_Cost_OffLineExp, # 兑换离线经验
@@ -4619,7 +4620,7 @@
Def_Cost_Trade, # 交易
Def_Cost_Rename, # 改名
Def_Cost_SkillLvUp, # 技能升级
) = range(2000, 2000 + 58)
) = range(2000, 2000 + 59)
Def_Cost_Reason_SonKey = "reason_name_son" # 消费点原因子类说明key
@@ -4699,6 +4700,7 @@
Def_Cost_AuctionBid:"AuctionBid",
Def_Cost_BuyDailyActionCnt:"BuyDailyActionCnt",
Def_Cost_FBBuyBuff:"FBBuyBuff",
Def_Cost_CreatFamily:"CreatFamily",
}
## -----------------------------------------------------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -2121,6 +2121,58 @@
#------------------------------------------------------
# A4 0D 通知建盟次数 #tagGCServerCreatFamilyTimes
class  tagGCServerCreatFamilyTimes(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("Times", c_int),    #建盟次数
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xA4
        self.SubCmd = 0x0D
        return
    def ReadData(self, stringData, _pos=0, _len=0):
        self.Clear()
        memmove(addressof(self), stringData[_pos:], self.GetLength())
        return _pos + self.GetLength()
    def Clear(self):
        self.Cmd = 0xA4
        self.SubCmd = 0x0D
        self.Times = 0
        return
    def GetLength(self):
        return sizeof(tagGCServerCreatFamilyTimes)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A4 0D 通知建盟次数 //tagGCServerCreatFamilyTimes:
                                Cmd:%s,
                                SubCmd:%s,
                                Times:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.Times
                                )
        return DumpString
m_NAtagGCServerCreatFamilyTimes=tagGCServerCreatFamilyTimes()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCServerCreatFamilyTimes.Cmd,m_NAtagGCServerCreatFamilyTimes.SubCmd))] = m_NAtagGCServerCreatFamilyTimes
#------------------------------------------------------
#A4 01  查看申请入会的玩家信息 #tagGCViewFamilyRequestInfo
class  tagtMemberInfo(Structure):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_CreateFamilyPayMoney.py
New file
@@ -0,0 +1,50 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package GY_Query_CreateFamilyPayMoney
# @todo: 建盟扣钱
#
# @author: xdh
# @date 2019-06-10 12:00
# @version 1.0
#
# @note: 建盟扣钱
#---------------------------------------------------------------------
#"""Version = 2019-06-10 12:00"""
#---------------------------------------------------------------------
import GameWorld
import PlayerControl
import ChConfig
#---------------------------------------------------------------------
## XX
#  @param query_Type 请求类型
#  @param query_ID 请求的玩家ID
#  @param packCMDList 发包命令
#  @param tick 当前时间
#  @return "True" or "False" or ""
def DoLogic(query_Type, query_ID, packCMDList, tick):
    return ''
## 登陆信息
#  @param curPlayer 发出请求的玩家
#  @param callFunName 功能名称
#  @param funResult 查询的结果
#  @param tick 当前时间
#  @return None
def DoResult(curPlayer, callFunName, funResult, tick):
    playerID = curPlayer.GetPlayerID()
    GameWorld.DebugLog("GY_Query_CreateFamilyPayMoney funResult=%s" % funResult, playerID)
    result = eval(funResult)
    if len(result) !=2:
        return
    type_Price, price = result
    PlayerControl.PayMoney(curPlayer, type_Price, price, ChConfig.Def_Cost_CreatFamily)
    return