| | |
| | | CrossMsg.SendToClientServer(ShareDefine.C2S_NotifyCode, dataMsg, [mainServerID], playerID)
|
| | | return
|
| | |
|
| | | def FamilyNotify(familyID, msgMark, msgParamList=[], excludeIDList=[]):
|
| | | def SendToFamilyPlayer(familyID, msgType, dataMsg, excludeIDList=[], onlyIDList=[], havePlayerCall=None):
|
| | | ## 发送给某个公会所有在线游戏服成员,跨服游戏服通用
|
| | | # @param havePlayerCall: 有curPlayer时回调函数,一般是游戏服时有,直接本服执行 func(curPlayer, familyID, dataMsg)
|
| | | family = DBDataMgr.GetFamilyMgr().FindFamily(familyID)
|
| | | if not family:
|
| | | return
|
| | |
| | | for index in range(family.GetCount()):
|
| | | member = family.GetAt(index)
|
| | | playerID = member.GetPlayerID()
|
| | | if onlyIDList and playerID not in onlyIDList:
|
| | | continue
|
| | | if excludeIDList and playerID in excludeIDList:
|
| | | continue
|
| | | crossPlayer = crossPlayerMgr.FindCrossPlayer(playerID)
|
| | |
| | | continue
|
| | | curPlayer = crossPlayer.GetPlayer()
|
| | | if curPlayer: # 有玩家,一般只有游戏服有,可视为游戏服在线,直接发送
|
| | | PlayerControl.NotifyCode(curPlayer, msgMark, msgParamList)
|
| | | if havePlayerCall:
|
| | | havePlayerCall(curPlayer, familyID, dataMsg)
|
| | | continue
|
| | | mainServerID = crossPlayer.GetMainServerID()
|
| | | if mainServerID == curServerID:
|
| | |
| | | playerIDList.append(playerID)
|
| | |
|
| | | for mainServerID, playerIDList in crossServerPlayerDict.items():
|
| | | dataMsg = {"playerIDList":playerIDList, "msgMark":msgMark, "msgParamList":msgParamList}
|
| | | CrossMsg.SendToClientServer(ShareDefine.C2S_NotifyCode, dataMsg, [mainServerID])
|
| | | sendDataMsg = {"playerIDList":playerIDList, "familyID":familyID}
|
| | | sendDataMsg.update(dataMsg)
|
| | | CrossMsg.SendToClientServer(msgType, sendDataMsg, [mainServerID])
|
| | | return
|
| | |
|
| | | def FamilyNotify(familyID, msgMark, msgParamList=[], excludeIDList=[]):
|
| | | family = DBDataMgr.GetFamilyMgr().FindFamily(familyID)
|
| | | if not family:
|
| | | return
|
| | | |
| | | def havePlayerCall(curPlayer, familyID, dataMsg):
|
| | | PlayerControl.NotifyCode(curPlayer, dataMsg["msgMark"], dataMsg["msgParamList"])
|
| | | return
|
| | | |
| | | dataMsg = {"msgMark":msgMark, "msgParamList":msgParamList}
|
| | | SendToFamilyPlayer(familyID, ShareDefine.C2S_NotifyCode, dataMsg, excludeIDList, havePlayerCall=havePlayerCall)
|
| | | return
|
| | |
|
| | | def C2S_NotifyCode(dataMsg):
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def GivePlayerResources(crossPlayer, awardItemList=None, moneyDict=None, eventName="", drDict=None):
|
| | | def GivePlayerResources(crossPlayer, awardItemList=None, moneyDict=None, eventName="", drDict=None, isNotifyAward=True):
|
| | | '''给玩家资源
|
| | | @param awardItemList: 给物品列表 [[itemID,itemCnt], ...]
|
| | | @param moneyDict: 给货币 {货币类型:消耗值, ...}
|
| | |
| | | dataMsg["moneyDict"] = moneyDict
|
| | | if drDict:
|
| | | dataMsg["drDict"] = drDict
|
| | | if not isNotifyAward:
|
| | | dataMsg["isNotifyAward"] = isNotifyAward
|
| | |
|
| | | playerID = crossPlayer.GetPlayerID()
|
| | | curPlayer = crossPlayer.GetPlayer()
|
| | |
| | | awardItemList = eventData.get("awardItemList", [])
|
| | | moneyDict = eventData.get("moneyDict", {})
|
| | | drDict = eventData.get("drDict", {})
|
| | | isNotifyAward = eventData.get("isNotifyAward", True)
|
| | |
|
| | | GameWorld.DebugLog("awardItemList=%s" % awardItemList)
|
| | | if awardItemList:
|
| | |
| | | for moneyType, moneyValue in moneyDict.items():
|
| | | PlayerControl.GiveMoney(curPlayer, moneyType, moneyValue, eventName, moneyRDict)
|
| | |
|
| | | ItemControler.NotifyGiveAwardInfo(curPlayer, awardItemList, eventName, moneyInfo=moneyDict)
|
| | | if isNotifyAward:
|
| | | ItemControler.NotifyGiveAwardInfo(curPlayer, awardItemList, eventName, moneyInfo=moneyDict)
|
| | | return
|
| | |
|
| | | def SetPlayerNomalDict(crossPlayer, setDict, isDayReset=False):
|