def removal(self, position): """摘除 @param position: int 摘除的位置 @return: int 摘除宝石的ID """ gemtemplate = getattr(self, "slot_%d" % position) if not gemtemplate: return 0 setattr(self, "slot_%d" % position, 0) dbItems.updateItemInfo(self._owner.baseInfo.id, "slot_%d" % position, 0) return gemtemplate
def removal(self,position): '''摘除 @param position: int 摘除的位置 @return: int 摘除宝石的ID ''' gemtemplate = getattr(self,'slot_%d'%position) if not gemtemplate: return 0 setattr(self,'slot_%d'%position,0) dbItems.updateItemInfo(self._owner.baseInfo.id, 'slot_%d'%position,0) return gemtemplate
def Mosaic(self, gemId, position): """镶嵌 @param gemId: int 宝石的ID @param position: int 镶嵌的位置 """ result = self.checkCanMosaic(gemId, position) if not result.get("result"): return result setattr(self, "slot_%d" % position, gemId) dbItems.updateItemInfo(self._owner.baseInfo.id, "slot_%d" % position, gemId) return {"result": True}
def Mosaic(self,gemId,position): '''镶嵌 @param gemId: int 宝石的ID @param position: int 镶嵌的位置 ''' result = self.checkCanMosaic(gemId, position) if not result.get('result'): return result setattr(self,'slot_%d'%position,gemId) dbItems.updateItemInfo(self._owner.baseInfo.id, 'slot_%d'%position, gemId) return {'result':True}