This commit is contained in:
aozhiwei 2021-11-11 17:27:26 +08:00
parent 2e3b720eb5
commit 97992f176e

View File

@ -73,9 +73,11 @@ class Simulate(object):
self._updatePartObj(self._getRealPartObj(partobj))
self._updateActivePlayerData(frame)
for objid in frame.out_objids:
del self._objHash[objid]
if objid in self._objHash:
del self._objHash[objid]
for objid in frame.del_objids:
del self._objHash[objid]
if objid in self._objHash:
del self._objHash[objid]
self._chgedBuffList(frame)
self._chgedPropList(frame)
@ -133,23 +135,27 @@ class Simulate(object):
def _updatePartObj(self, obj):
entity = self._objHash[obj.obj_uniid]
entity.pos = obj.pos
entity.dir = obj.dir
entity.pos.x = 100
#entity.dir = obj.dir
def _updateActivePlayerData(self, frame):
active_player = self._objHash[frame.active_player_id]
self._curr_player['obj_uniid'] = frame.active_player_id
self._curr_player['action_type'] = frame.action_type
self._curr_player['action_duration'] = frame.action_duration
self._curr_player['action_frameno'] = frame.action_frameno
self._curr_player['items'] = frame.items
self._curr_player['inventory'] = frame.inventory
self._curr_player['cur_weapon_idx'] = frame.cur_weapon_idx
self._curr_player['weapons'] = frame.weapons
self._curr_player['skill_list'] = frame.skill_list
if not frame.active_player_data:
return
if frame.active_player_id:
self._curr_player['obj_uniid'] = frame.active_player_id
self._curr_player['action_type'] = frame.active_player_data.action_type
self._curr_player['action_duration'] = frame.active_player_data.action_duration
self._curr_player['action_frameno'] = frame.active_player_data.action_frameno
self._curr_player['items'] = frame.active_player_data.items
self._curr_player['inventory'] = frame.active_player_data.inventory
self._curr_player['cur_weapon_idx'] = frame.active_player_data.cur_weapon_idx
self._curr_player['weapons'] = frame.active_player_data.weapons
self._curr_player['skill_list'] = frame.active_player_data.skill_list
def _chgedBuffList(self, frame):
for chged_buff in frame.chged_buff_list:
if chged_buff.obj_id not in self._objHash:
continue
entity = self._objHash[chged_buff.obj_id]
if entity:
if chged_buff.chg == 0:
@ -164,15 +170,15 @@ class Simulate(object):
self.applyChgedProp(entity, chged_prop)
def _entityUpdateBuff(self, entity, pb_buff):
buff = self.getBuffByUniId(self, entity, pb_buff.buff_uniid)
buff = self.getBuffByUniId(entity, pb_buff.buff_uniid)
if buff:
entity.buff_list.erase(buff)
entity.buff_list.remove(buff)
entity.buff_list.append(pb_buff)
def _entityRemoveBuff(self, entity, pb_buff):
buff = self.getBuffByUniId(self, entity, pb_buff.buff_uniid)
buff = self.getBuffByUniId(entity, pb_buff.buff_uniid)
if buff:
entity.buff_list.erase(buff)
entity.buff_list.remove(buff)
def getBuffByUniId(self, entity, buff_uniid):
for buff in entity.buff_list: