6805 【后端】【2.0】副本前端化(去除木桩非自定义场景召唤限制,最大同时存在木桩数改为3个,设置玩家血量改为玩家掉血)
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B4 0E 设置玩家自身血量 #tagCMSetRoleHP
|
| | | # B4 0E 玩家掉血 #tagCMRoleLostHP
|
| | |
|
| | | class tagCMSetRoleHP(Structure):
|
| | | class tagCMRoleLostHP(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("HP", c_int), |
| | | ("LostHP", c_int), |
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def Clear(self):
|
| | | self.Cmd = 0xB4
|
| | | self.SubCmd = 0x0E
|
| | | self.HP = 0
|
| | | self.LostHP = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMSetRoleHP)
|
| | | return sizeof(tagCMRoleLostHP)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B4 0E 设置玩家自身血量 //tagCMSetRoleHP:
|
| | | DumpString = '''// B4 0E 玩家掉血 //tagCMRoleLostHP:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | HP:%d
|
| | | LostHP:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.HP
|
| | | self.LostHP
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMSetRoleHP=tagCMSetRoleHP()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMSetRoleHP.Cmd,m_NAtagCMSetRoleHP.SubCmd))] = m_NAtagCMSetRoleHP
|
| | | m_NAtagCMRoleLostHP=tagCMRoleLostHP()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMRoleLostHP.Cmd,m_NAtagCMRoleLostHP.SubCmd))] = m_NAtagCMRoleLostHP
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | |
| | |
|
| | | PacketCMD_22=0xB4
|
| | | PacketSubCMD_22=0x0E
|
| | | PacketCallFunc_22=OnSetRoleHP
|
| | | PacketCallFunc_22=OnRoleLostHP
|
| | |
|
| | | ;购买相关的
|
| | | [BuySomething]
|
| | |
| | | #对象已经死亡
|
| | | return False
|
| | |
|
| | | #添加(系统)隐身者不可攻击,证明家族战非隐身;自定义场景中是隐身的不做限制
|
| | | if not attacker.GetVisible() and not attacker.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | #添加(系统)隐身者不可攻击,证明家族战非隐身
|
| | | if not attacker.GetVisible():
|
| | | return False
|
| | |
|
| | | if not defender.GetVisible():
|
| | |
| | | if defenderCampType == ChConfig.CampType_Justice:
|
| | | return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_None
|
| | |
|
| | | #私有木桩只能自己打自己的
|
| | | if curTagNormalNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | summonPlayerID = curTagNormalNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
|
| | | if curPlayer.GetPlayerID() != summonPlayerID:
|
| | | return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
|
| | | return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
|
| | | |
| | | return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
|
| | |
|
| | | ## 攻击
|
| | |
| | |
|
| | | #私有木桩只能自己打自己的
|
| | | if curTagSummonNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | if not GameWorld.IsSameObj(curPlayer, curTagPlayer):
|
| | | summonPlayerID = curTagSummonNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
|
| | | if curPlayer.GetPlayerID() != summonPlayerID:
|
| | | return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
|
| | | return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
|
| | |
|
| | |
| | | if curPlayer != None and curTagPlayer != None :
|
| | | #私有木桩只能自己打自己的
|
| | | if curTagSummon.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | if not GameWorld.IsSameObj(curPlayer, curTagPlayer):
|
| | | summonPlayerID = curTagSummon.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
|
| | | if curPlayer.GetPlayerID() != summonPlayerID:
|
| | | return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
|
| | | return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
|
| | |
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B4 0E 设置玩家自身血量 #tagCMSetRoleHP
|
| | | # B4 0E 玩家掉血 #tagCMRoleLostHP
|
| | |
|
| | | class tagCMSetRoleHP(Structure):
|
| | | class tagCMRoleLostHP(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("HP", c_int), |
| | | ("LostHP", c_int), |
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def Clear(self):
|
| | | self.Cmd = 0xB4
|
| | | self.SubCmd = 0x0E
|
| | | self.HP = 0
|
| | | self.LostHP = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMSetRoleHP)
|
| | | return sizeof(tagCMRoleLostHP)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B4 0E 设置玩家自身血量 //tagCMSetRoleHP:
|
| | | DumpString = '''// B4 0E 玩家掉血 //tagCMRoleLostHP:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | HP:%d
|
| | | LostHP:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.HP
|
| | | self.LostHP
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMSetRoleHP=tagCMSetRoleHP()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMSetRoleHP.Cmd,m_NAtagCMSetRoleHP.SubCmd))] = m_NAtagCMSetRoleHP
|
| | | m_NAtagCMRoleLostHP=tagCMRoleLostHP()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMRoleLostHP.Cmd,m_NAtagCMRoleLostHP.SubCmd))] = m_NAtagCMRoleLostHP
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | |
| | | import ChConfig
|
| | | import GameWorld
|
| | | import NPCCommon
|
| | | import PlayerFB
|
| | | import PlayerControl
|
| | | import ShareDefine
|
| | |
|
| | | #
|
| | |
| | | #输入命令格式错误
|
| | | if not paramList:
|
| | | GameWorld.DebugAnswer(curPlayer, "SummonNPC npcID 个数")
|
| | | GameWorld.DebugAnswer(curPlayer, "SummonNPC npcID 个数 前端场景ID lineID 血量")
|
| | | GameWorld.DebugAnswer(curPlayer, "SummonNPC npcID 个数 血量")
|
| | | return
|
| | |
|
| | | #NPC对象ID
|
| | |
| | |
|
| | | npcType = npcData.GetType()
|
| | | if npcType in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | mapID = paramList[2] if len(paramList) > 2 else 0
|
| | | lineID = paramList[3] if len(paramList) > 3 else 0
|
| | | setHP = paramList[4] if len(paramList) > 4 else 0
|
| | | if not mapID:
|
| | | GameWorld.DebugAnswer(curPlayer, "木桩怪必须指定地图ID才能召唤!")
|
| | | return
|
| | | |
| | | customMapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | customLineID = PlayerControl.GetCustomLineID(curPlayer)
|
| | | if mapID != customMapID or lineID != customLineID:
|
| | | if customMapID:
|
| | | PlayerFB.DoExitCustomScene(curPlayer)
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | PlayerFB.DoEnterCustomScene(curPlayer, mapID, lineID, tick)
|
| | | |
| | | setHP = paramList[2] if len(paramList) > 2 else 0
|
| | | hp = setHP % ShareDefine.Def_PerPointValue
|
| | | hpEx = setHP / ShareDefine.Def_PerPointValue
|
| | | NPCCommon.SummonPriWoodPile(curPlayer, npcID, npcCount, hp, hpEx)
|
| | |
| | | import NPCCommon
|
| | | import GameWorld
|
| | | import GameMap
|
| | | import ChConfig
|
| | |
|
| | |
|
| | | ##AI逻辑处理
|
| | |
| | | #刷新自己的Buff
|
| | | npcControl.RefreshBuffState(tick)
|
| | |
|
| | | owner = NPCCommon.GetNpcObjOwnerDetail(curNPC)
|
| | | summonPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
|
| | | if not summonPlayerID:
|
| | | return
|
| | | owner = GameWorld.GetObj(summonPlayerID, IPY_GameWorld.gotPlayer)
|
| | | if not owner:
|
| | | return
|
| | |
|
| | |
| | | ''' 召唤私有专属木桩怪
|
| | | '''
|
| | |
|
| | | if not curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | GameWorld.DebugLog("玩家当前不是在自定义场景中,不允许招木桩!")
|
| | | return
|
| | | |
| | | mapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | lineID = PlayerControl.GetCustomLineID(curPlayer)
|
| | | if mapID:
|
| | |
| | | if playerID not in PyGameData.g_playerPriWoodPileNPCDict:
|
| | | PyGameData.g_playerPriWoodPileNPCDict[playerID] = []
|
| | | playerPriWoodNPCList = PyGameData.g_playerPriWoodPileNPCDict[playerID]
|
| | | maxCount = 10
|
| | | maxCount = 3
|
| | | nowCount = len(playerPriWoodNPCList)
|
| | | summonCount = min(count, maxCount - nowCount)
|
| | | #GameWorld.DebugLog("召唤: count=%s,maxCount=%s,nowCount=%s,summonCount=%s,hp=%s,hpEx=%s"
|
| | |
| | | def __NPCDropItem(self, dropPlayer, hurtType, hurtID, ownerPlayerList=[]):
|
| | | if not dropPlayer:
|
| | | return
|
| | | if dropPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | GameWorld.DebugLog("前端自定义场景中,不掉落物品!")
|
| | | return
|
| | | curNPC = self.__Instance
|
| | | if curNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | GameWorld.DebugLog("木桩怪,不掉落物品!")
|
| | | return
|
| | | npcID = curNPC.GetNPCID()
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | mapID = FBCommon.GetRecordMapID(mapID)
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | | #// B4 0E 设置玩家自身血量 #tagCMSetRoleHP
|
| | | #// B4 0E 玩家掉血 #tagCMRoleLostHP
|
| | | #
|
| | | #struct tagCMSetRoleHP
|
| | | #struct tagCMRoleLostHP
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD HP;
|
| | | # DWORD LostHP;
|
| | | #};
|
| | | def OnSetRoleHP(index, clientData, tick):
|
| | | def OnRoleLostHP(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | if not curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | GameWorld.DebugLog("玩家当前不是在自定义场景中,不允许设置自身血量!")
|
| | | return
|
| | | setHP = max(1, min(clientData.HP, curPlayer.GetMaxHP()))
|
| | | curPlayer.SetHP(setHP)
|
| | | lostHP = clientData.LostHP
|
| | | curHP = curPlayer.GetHP()
|
| | | updHP = curHP - lostHP
|
| | | if updHP <= 0:
|
| | | #玩家已经死亡
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | playerControl.SetDead()
|
| | | else:
|
| | | curPlayer.SetHP(updHP)
|
| | | |
| | | return
|
| | |
| | |
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1) # 由于前端不一定有发mapID,所以这里额外记录这个状态,不能直接用mapID判断
|
| | | PlayerControl.SetCustomMap(curPlayer, mapID, lineID)
|
| | | NPCCommon.ClearPriWoodPile(curPlayer)
|
| | | GameWorld.Log("玩家开始自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), playerID)
|
| | | if mapID:
|
| | | PetControl.DoLogic_PetLoadMapOK(curPlayer)
|