コード例 #1
0
def ItemVariantsAHLoad(item, dbconn, id):
    restoredVariants = {}

    if (item.hasVariants):
        for code,svalue,value,value2,value3,value4,value5 in dbconn.execute("SELECT code,svalue,value,value2,value3,value4,value5 from ItemVariant WHERE item_list_id = %s;"%id): 
            if code == V_STAT:
                if item.spellEnhanceLevel == 9999:  # indicates an enchanted item, additional stat value
                    if value2:	# hack for float values
                        statValue = float(value) + float(value2) / 100.0
                    else:
                        statValue = value
                    var = (svalue,statValue)
                else:
                    var = (svalue,value)
                try:
                    restoredVariants[V_STAT].append(var)
                except KeyError:
                    restoredVariants[V_STAT] = [var]
            # Because of their unique abilities, V_WEAPON mods need to be kept separately.
            # They get stored in a list so one can still edit them independently.
            elif code == V_WEAPON:
                restoredVariants[V_WEAPON] = [value,value2,value3,value4]
            elif code == V_BANEWEAPON:
                restoredVariants[V_BANEWEAPON] = (svalue,value)
            elif code == V_WEAPONPROC:
                proc = ItemSpellTemp(SpellProto.byName(svalue),RPG_ITEM_TRIGGER_POISON,value)
                item.procs[proc] = [value2,value3]
                
        item.variants = restoredVariants
コード例 #2
0
def ItemVariantsLoad(item):
    dbItem = item.item
    restoredVariants = {}
    for variant in list(dbItem.variants):
        if variant.code == V_STAT:
            if dbItem.spellEnhanceLevel == 9999:  # indicates an enchanted item, additional stat value
                if variant.value2:	# hack for float values
                    statValue = float(variant.value) + float(variant.value2) / 100.0
                else:
                    statValue = variant.value
                var = (variant.svalue,statValue)
            else:
                var = (variant.svalue,variant.value)
            try:
                restoredVariants[V_STAT].append(var)
            except KeyError:
                restoredVariants[V_STAT] = [var]
        # Because of their unique abilities, V_WEAPON mods need to be kept separately.
        # They get stored in a list so one can still edit them independently.
        elif variant.code == V_WEAPON:
            restoredVariants[V_WEAPON] = [variant.value,variant.value2,variant.value3,variant.value4]
        elif variant.code == V_BANEWEAPON:
            restoredVariants[V_BANEWEAPON] = (variant.svalue,variant.value)
        elif variant.code == V_WEAPONPROC:
            proc = ItemSpellTemp(SpellProto.byName(variant.svalue),RPG_ITEM_TRIGGER_POISON,variant.value)
            item.procs[proc] = [variant.value2,variant.value3]
    item.variants = restoredVariants
コード例 #3
0
 def install(self,char):
     try:
         sp = SpellProto.byName(self.protoName)
     except:
         print "Spell: %s no longer exists"%self.protoName
         return
     
     FilterColumns(SpellStore,self.dbAttr)
     self.dbAttr["spellProtoID"] = sp.id
     self.dbAttr["characterID"] = char.id
     SpellStore(**self.dbAttr)
コード例 #4
0
    def install(self, char):
        try:
            sp = SpellProto.byName(self.protoName)
        except:
            print "Spell: %s no longer exists" % self.protoName
            return

        FilterColumns(SpellStore, self.dbAttr)
        self.dbAttr["spellProtoID"] = sp.id
        self.dbAttr["characterID"] = char.id
        SpellStore(**self.dbAttr)