Exemplo n.º 1
0
 def open(self):
     ensure_imports()
     items = _item.items()
     lst = [it for it in items if it.drop and it._level <= self.max_level and it._level + it.max_rank * it.rank_add_level >= self.min_level]
     it = random.choice(lst)
     self.item_id = it.id
     ranks = [rank for rank in range(0, it.max_rank + 1) if self.min_level <= it._level + rank * it.rank_add_level <= self.max_level]
     self.rank = random.choice(ranks)
     return ItemLoot.open(self)
Exemplo n.º 2
0
 def do_items(self):  # this actually should be from the rss1.0 ns
     if not self.attrs.has_key((rdfNS, "about")):
         self.log(
             MissingAttribute({
                 "parent": self.name,
                 "element": self.name,
                 "attr": "rdf:about"
             }))
     from item import items
     return items(), noduplicates()
Exemplo n.º 3
0
    def do_items(self):  # this actually should be from the rss1.0 ns
        if not self.attrs.has_key((rdfNS, "about")):
            self.log(MissingAttribute({"parent": self.name, "element": self.name, "attr": "rdf:about"}))
        from item import items

        return items(), noduplicates()
Exemplo n.º 4
0
 def itemshop(user):
     res = {"shop": [item.get(it.id, rank).js() for it in item.items() if it.shop for rank in range(0, it.max_rank) if it.get_level_for_rank(rank) <= user["level"]]}
     return res