GeneralId = param['GeneralId'] EquipPart = param['EquipPart'] Flag = param.get('Flag') #False脱装备;1脱宝物;其他脱兵书 modGeneral = Gcore.getMod('General', self.uid) General = modGeneral.getGeneralInfo(GeneralId) if not General: return Gcore.error(optId, -15016001) #玩家无此武将 if not Flag: stat = modGeneral.stripEquip(General, EquipPart) if stat == -1: return Gcore.error(optId, -15016002) #装备部位不正确或该武将在该部位上没有装备 if stat == -2: return Gcore.error(optId, -15016003) #向背包中增加装备失败 else: stat = modGeneral.stripEquip_EX(GeneralId, Flag) if stat == -1: return Gcore.error(optId, -15016004) #没穿兵书或宝物 if stat == -2: return Gcore.error(optId, -15016005) #背包已满 #返回 return Gcore.out(optId, body={}) #end class Building_trainUI if __name__ == '__main__': o = Building_trainUI(44493) print Gcore.printd(o.GetGenerals())
gc = generalCfg.get(g.get('GeneralType')) ies = gc.get('InterEffectId') if not ies: continue ies = ies.split(',') for ie in ies: effectId = int(ie) gAttr = g['TrainForceValue']+g['TrainWitValue']+g['TrainSpeedValue']+g['TrainLeaderValue'] gAttr += g['ForceValue']+g['WitValue']+g['SpeedValue']+g['LeaderValue'] attrAdd = gAttr/5000.0#todo基数配置,内政初始数值配置 effectValue = round(0.01*(1+attrAdd),2) result[effectId] = result.get(effectId,0) +effectValue return result def addTrainRecord(self,gt,tt): ''' :武将训练记录 @param gt:武将类型 @param tt:训练类型 #By Zhanggh 2013-5-29 ''' data = {'UserId':self.uid,'GeneralType':gt, 'UserType':Gcore.getUserData(self.uid,'UserType'), 'TrainType':tt,'CreateTime':time.time()} self.db.insert('tb_log_general_train',data,isdelay=True) #end class GeneralMod if __name__ == '__main__': c = GeneralMod(44493) Gcore.printd(c.getLatestGeneralInfo())
def test(): uid = 1001 c = TemplateUI(uid) Gcore.printd(d)
-15133001:"武将卡ID不正确", -15133002:"武将卡数量不足", -15133003:"背包空间不足", -15133004:"武将卡数量不足(并发导致)", #点将台 -15012002:"武将身上有装备,无法遣散", -15016003:"向背包中增加装备失败", -15010005:"货币类型错误", #外史院 -15070001:"军团成员已满", -15070002:"没有申请记录", -15064004:'离上次退出军团时间间隔不符合要求', # 装备 -16006001:"装备不存在", -16006002:"源装备等级必须大于0", -16006003:"目标装备等级已达最大", -16007001:"升级物品不存在", -16007002:"必须让武将穿戴才能升级", -16007003:"已达最大等级", } if __name__ == '__main__': from sgLib.core import Gcore Gcore.printd(lang)
EquipPart = param['EquipPart'] Flag = param.get('Flag') #False脱装备;1脱宝物;其他脱兵书 modGeneral = Gcore.getMod('General', self.uid) General = modGeneral.getGeneralInfo(GeneralId) if not General: return Gcore.error(optId, -15016001) #玩家无此武将 if not Flag: stat = modGeneral.stripEquip(General, EquipPart) if stat == -1: return Gcore.error(optId, -15016002) #装备部位不正确或该武将在该部位上没有装备 if stat == -2: return Gcore.error(optId, -15016003) #向背包中增加装备失败 else: stat = modGeneral.stripEquip_EX(GeneralId, Flag) if stat == -1: return Gcore.error(optId, -15016004) #没穿兵书或宝物 if stat == -2: return Gcore.error(optId, -15016005) #背包已满 #返回 return Gcore.out(optId, body={}) #end class Building_trainUI if __name__ == '__main__': o = Building_trainUI(44493) print Gcore.printd(o.GetGenerals())