コード例 #1
0
 def onChangeAugments(self, new_num_augments):
   new_num_augments = int(new_num_augments)
   (gear_id_bytes, index, post_index, skill_a_id, skill_a_incr, skill_b_id, skill_b_incr,
    skill_c_id, skill_c_incr, augment_a_id, augment_b_id, augment_c_id) = parse_gear_bytes(self.cur_slot_bytes)
   cur_num_augments = (augment_a_id != 0xFFFF) + (augment_b_id != 0xFFFF) + (augment_c_id != 0xFFFF)
   if new_num_augments == cur_num_augments:
     return
   if augment_a_id == 0xFFFF:
     augment_a_id = augment_b_id
     augment_b_id = augment_c_id
     augment_c_id = 0xFFFF
   if augment_a_id == 0xFFFF:
     augment_a_id = augment_b_id
     augment_b_id = 0xFFFF
   if new_num_augments == 1:
     if augment_a_id == 0xFFFF: augment_a_id = 0x0000
     augment_b_id = 0xFFFF
     augment_c_id = 0xFFFF
   elif new_num_augments == 2:
     if augment_a_id == 0xFFFF: augment_a_id = 0x0000
     if augment_b_id == 0xFFFF: augment_b_id = 0x0000
     augment_c_id = 0xFFFF
   elif new_num_augments == 3:
     if augment_a_id == 0xFFFF: augment_a_id = 0x0000
     if augment_b_id == 0xFFFF: augment_b_id = 0x0000
     if augment_c_id == 0xFFFF: augment_c_id = 0x0000
   else: # Assume new_num_augments == 0 by default
     augment_a_id = 0xFFFF
     augment_b_id = 0xFFFF
     augment_c_id = 0xFFFF
   self.cur_slot_bytes = form_gear_bytes(gear_id_bytes, index, post_index, skill_a_id, skill_a_incr,
                                         skill_b_id, skill_b_incr, skill_c_id, skill_c_incr,
                                         augment_a_id, augment_b_id, augment_c_id)
   self.updateUI()
コード例 #2
0
  def updateUI(self):
    # Disable editing if cache missing
    if not (0 <= self.cur_slot_idx < len(self.slots_cache)) or self.cur_slot_bytes is None:
      self.cur_slot_idx = -1
      self.cur_slot_bytes = None
      self.cmb_slots.setDisabled(True)
      self.cmb_skills_a.setDisabled(True)
      self.cmb_skills_b.setDisabled(True)
      self.cmb_skills_c.setDisabled(True)
      self.cmb_incr_a.setDisabled(True)
      self.cmb_incr_b.setDisabled(True)
      self.cmb_incr_c.setDisabled(True)
      self.cmb_augments.setDisabled(True)
      self.txt_raw.setDisabled(True)
      return
    else:
      self.cmb_slots.setDisabled(False)
      self.cmb_skills_a.setDisabled(False)
      self.cmb_skills_b.setDisabled(False)
      self.cmb_skills_c.setDisabled(False)
      self.cmb_incr_a.setDisabled(False)
      self.cmb_incr_b.setDisabled(False)
      self.cmb_incr_c.setDisabled(False)
      self.cmb_augments.setDisabled(False)
      self.txt_raw.setDisabled(False)

    # Validate current slot's raw bytes
    try:
      (gear_id_bytes, index, post_index, skill_a_id, skill_a_incr, skill_b_id, skill_b_incr,
       skill_c_id, skill_c_incr, augment_a_id, augment_b_id, augment_c_id) = parse_gear_bytes(self.cur_slot_bytes)
      cur_slot_words = struct.unpack('>IIIIII', self.cur_slot_bytes)
      num_augments = (augment_a_id != 0xFFFF) + (augment_b_id != 0xFFFF) + (augment_c_id != 0xFFFF)
    except ValueError, e:
      self.log.emit('Gear parsing failed: %s' % e.what(), 'red')
      return
コード例 #3
0
 def onChangeIncrC(self, new_incr):
   new_incr = int(new_incr)
   (gear_id_bytes, index, post_index, skill_a_id, skill_a_incr, skill_b_id, skill_b_incr,
    skill_c_id, skill_c_incr, augment_a_id, augment_b_id, augment_c_id) = parse_gear_bytes(self.cur_slot_bytes)
   if new_incr == skill_c_incr:
     return
   self.cur_slot_bytes = form_gear_bytes(gear_id_bytes, index, post_index, skill_a_id, skill_a_incr,
                                         skill_b_id, skill_b_incr, skill_c_id, new_incr,
                                         augment_a_id, augment_b_id, augment_c_id)
   self.updateUI()
コード例 #4
0
 def onChangeIncrB(self, new_incr):
     new_incr = int(new_incr)
     (gear_id_bytes, index, post_index, skill_a_id, skill_a_incr,
      skill_b_id, skill_b_incr, skill_c_id, skill_c_incr, augment_a_id,
      augment_b_id, augment_c_id) = parse_gear_bytes(self.cur_slot_bytes)
     if new_incr == skill_b_incr:
         return
     self.cur_slot_bytes = form_gear_bytes(gear_id_bytes, index, post_index,
                                           skill_a_id, skill_a_incr,
                                           skill_b_id, new_incr, skill_c_id,
                                           skill_c_incr, augment_a_id,
                                           augment_b_id, augment_c_id)
     self.updateUI()
コード例 #5
0
 def onChangeSkillC(self, skill):
   skill = str(skill)
   if skill in self.skill2id:
     new_skill_id = self.skill2id[skill]
     (gear_id_bytes, index, post_index, skill_a_id, skill_a_incr, skill_b_id, skill_b_incr,
      skill_c_id, skill_c_incr, augment_a_id, augment_b_id, augment_c_id) = parse_gear_bytes(self.cur_slot_bytes)
     if new_skill_id == skill_c_id:
       return
     self.cur_slot_bytes = form_gear_bytes(gear_id_bytes, index, post_index, skill_a_id, skill_a_incr,
                                           skill_b_id, skill_b_incr, new_skill_id, skill_c_incr,
                                           augment_a_id, augment_b_id, augment_c_id)
     self.updateUI()
   else:
     self.log.emit('Coding Error: unrecognized skill - %s' % skill, 'red')
コード例 #6
0
 def onChangeSkillC(self, skill):
     skill = str(skill)
     if skill in self.skill2id:
         new_skill_id = self.skill2id[skill]
         (gear_id_bytes, index, post_index, skill_a_id, skill_a_incr,
          skill_b_id, skill_b_incr, skill_c_id, skill_c_incr, augment_a_id,
          augment_b_id,
          augment_c_id) = parse_gear_bytes(self.cur_slot_bytes)
         if new_skill_id == skill_c_id:
             return
         self.cur_slot_bytes = form_gear_bytes(gear_id_bytes, index,
                                               post_index, skill_a_id,
                                               skill_a_incr, skill_b_id,
                                               skill_b_incr, new_skill_id,
                                               skill_c_incr, augment_a_id,
                                               augment_b_id, augment_c_id)
         self.updateUI()
     else:
         self.log.emit('Coding Error: unrecognized skill - %s' % skill,
                       'red')
コード例 #7
0
 def onChangeAugments(self, new_num_augments):
     new_num_augments = int(new_num_augments)
     (gear_id_bytes, index, post_index, skill_a_id, skill_a_incr,
      skill_b_id, skill_b_incr, skill_c_id, skill_c_incr, augment_a_id,
      augment_b_id, augment_c_id) = parse_gear_bytes(self.cur_slot_bytes)
     cur_num_augments = (augment_a_id != 0xFFFF) + (
         augment_b_id != 0xFFFF) + (augment_c_id != 0xFFFF)
     if new_num_augments == cur_num_augments:
         return
     if augment_a_id == 0xFFFF:
         augment_a_id = augment_b_id
         augment_b_id = augment_c_id
         augment_c_id = 0xFFFF
     if augment_a_id == 0xFFFF:
         augment_a_id = augment_b_id
         augment_b_id = 0xFFFF
     if new_num_augments == 1:
         if augment_a_id == 0xFFFF: augment_a_id = 0x0000
         augment_b_id = 0xFFFF
         augment_c_id = 0xFFFF
     elif new_num_augments == 2:
         if augment_a_id == 0xFFFF: augment_a_id = 0x0000
         if augment_b_id == 0xFFFF: augment_b_id = 0x0000
         augment_c_id = 0xFFFF
     elif new_num_augments == 3:
         if augment_a_id == 0xFFFF: augment_a_id = 0x0000
         if augment_b_id == 0xFFFF: augment_b_id = 0x0000
         if augment_c_id == 0xFFFF: augment_c_id = 0x0000
     else:  # Assume new_num_augments == 0 by default
         augment_a_id = 0xFFFF
         augment_b_id = 0xFFFF
         augment_c_id = 0xFFFF
     self.cur_slot_bytes = form_gear_bytes(gear_id_bytes, index, post_index,
                                           skill_a_id, skill_a_incr,
                                           skill_b_id, skill_b_incr,
                                           skill_c_id, skill_c_incr,
                                           augment_a_id, augment_b_id,
                                           augment_c_id)
     self.updateUI()
コード例 #8
0
    def updateUI(self):
        # Disable editing if cache missing
        if not (0 <= self.cur_slot_idx < len(
                self.slots_cache)) or self.cur_slot_bytes is None:
            self.cur_slot_idx = -1
            self.cur_slot_bytes = None
            self.cmb_slots.setDisabled(True)
            self.cmb_skills_a.setDisabled(True)
            self.cmb_skills_b.setDisabled(True)
            self.cmb_skills_c.setDisabled(True)
            self.cmb_incr_a.setDisabled(True)
            self.cmb_incr_b.setDisabled(True)
            self.cmb_incr_c.setDisabled(True)
            self.cmb_augments.setDisabled(True)
            self.txt_raw.setDisabled(True)
            return
        else:
            self.cmb_slots.setDisabled(False)
            self.cmb_skills_a.setDisabled(False)
            self.cmb_skills_b.setDisabled(False)
            self.cmb_skills_c.setDisabled(False)
            self.cmb_incr_a.setDisabled(False)
            self.cmb_incr_b.setDisabled(False)
            self.cmb_incr_c.setDisabled(False)
            self.cmb_augments.setDisabled(False)
            self.txt_raw.setDisabled(False)

        # Validate current slot's raw bytes
        try:
            (gear_id_bytes, index, post_index, skill_a_id, skill_a_incr,
             skill_b_id, skill_b_incr, skill_c_id, skill_c_incr, augment_a_id,
             augment_b_id,
             augment_c_id) = parse_gear_bytes(self.cur_slot_bytes)
            cur_slot_words = struct.unpack('>IIIIII', self.cur_slot_bytes)
            num_augments = (augment_a_id != 0xFFFF) + (
                augment_b_id != 0xFFFF) + (augment_c_id != 0xFFFF)
        except ValueError, e:
            self.log.emit('Gear parsing failed: %s' % e.what(), 'red')
            return