Ejemplo n.º 1
0
 def sellstuff(self, stuff, toperson):
     if toperson.money >= stuff.price and stuff.ownerid == self.playerid:
         #solidinvestment = doo.getplayer(stuff.solidinvestment)
         solidstuff = doo.getsolidstuffbyplayerid(stuff.solidinvestment)
         tax = stuff.price * solidstuff.gettax()
         self.money += float(stuff.price - tax)
         self.put()
         #self.stuff.remove(stuff.stuffid)
         
         if stuff.sellto(toperson):
             toperson.points += 1
             toperson.put()
             
             stuff.put()
 
             self.points += 1
             
             #doo.makealert(self, "Sold %s to %s for %s" % (stuff.name, toperson.name, stuff.price))
             self.put()
             
             doo.collecttax(stuff, stuff.price)
             
             return True
         else:
             return False
     else:
         return False
Ejemplo n.º 2
0
    def get(self):
        user = users.get_current_user()
        if not user:
            self.redirect("/")

        player = doo.getplayerbyuser(user)
        if not player:
            player = doo.makeplayer(user.nickname(), user=user)
            
        investment = doo.getplayer(self.request.get('param'))
        
        levelprogress, nextlevel = investment.checklevel()
        
        occupation = investment.getoccupation()
        
        solidstuff = doo.getsolidstuffbyplayerid(investment.playerid)
        
        meinthem = doo.getplayerinvestment(player.playerid, investment.playerid)
        theminme = doo.getplayerinvestment(investment.playerid, player.playerid)
        
        if investment.playerid in player.friends:
            friend = True
        else:
            friend = False
            
        lastdividenddate = formattar.getprettydate(investment.lastdividenddate)
            
    	template_values = {
            'investment': investment,
            'friend': friend,
            'solidstuff': solidstuff,
            'lastdividenddate': lastdividenddate,
            'meinthem': meinthem,
            'theminme': theminme,
            'player': player,
            'occupation': occupation,
            'levelprogress': levelprogress,
            'nextlevel': nextlevel,
            }

        if player.mobile:
            templatefile = 'm_playerinfo.html'
        else:
            templatefile = 'playerinfo.html'
        path = os.path.join(os.path.dirname(__file__), templatefile)
        self.response.out.write(template.render(path, template_values))
Ejemplo n.º 3
0
 def calculatenewstuffs(self):
     solidstuff = doo.getsolidstuffbyplayerid(self.playerid)
     stuff = doo.getstuffbyname(solidstuff.stuffname)
     should = int(self.totalinvestorsamount / solidstuff.ratio)
     needtocreate = int(should - solidstuff.count)
     
     if solidstuff.count + needtocreate > solidstuff.cap:
         needtocreate = solidstuff.cap - solidstuff.count
     
     #ingroup = 10
     #groupnum = needtocreate / ingroup
     #rem = needtocreate % ingroup
     #logging.info('needtocreate: %s, %s, %s' % (needtocreate, should, stuff.name))
     if needtocreate > 0:
         solidstuff.count += needtocreate
         solidstuff.put()
         stuff.total += needtocreate
         stuff.forsale += needtocreate
         stuff.put()
         self.addplayerstuff(stuff.stuffid, needtocreate)
Ejemplo n.º 4
0
 def getsolidstufftaxdisplay(self):
     solidstuff = doo.getsolidstuffbyplayerid(self.playerid)
     return solidstuff.gettaxdisplay()
Ejemplo n.º 5
0
 def getsolidstuff(self):
     solidstuff = doo.getsolidstuffbyplayerid(self.playerid)
     return solidstuff
Ejemplo n.º 6
0
 def getsolidstufftaxdisplay(self):
     solidstuff = doo.getsolidstuffbyplayerid(self.solidinvestment)
     return formattar.getpercent(self.getsolidstufftax() * 100)
Ejemplo n.º 7
0
 def getsolidstufftax(self):
     solidstuff = doo.getsolidstuffbyplayerid(self.solidinvestment)
     return solidstuff.gettax()