public void copyModuleWithNewBody(String charactor, int bodyId, String name) { CharacterTbl chaTbl = findCharactor(charactor); List <CosBean> coslist = chaTbl.findCosByItemId(bodyId); if (coslist.Count == 0) { throw new Exception("BodyItemId" + bodyId + "NotFound"); } ModuleBean mb = modules.findModuleByCos(charactor, StringCut.cosId2String(coslist[0].id)); copyModuleWithNewBody(mb.id, name); }
public void copyModuleWithNewBody(int moduleId, String name) { ModuleBean mb = new ModuleBean(modules.findModuleById(moduleId)); CharacterTbl chaTbl = findCharactor(mb.chara); //更新module mb.id = modules.lastModuleId + 1; mb.sort_index = modules.lastSortIndex + 1; if (!name.Equals("")) { mb.name = mb.name + name; } int oriCosId = StringCut.cosString2Id(mb.cos); mb.cos = StringCut.cosId2String(chaTbl.lastCosId + 1); modules.add(mb); //更新cos CosBean newCos = new CosBean(chaTbl.findCosById(oriCosId)); int OldBodyno = chaTbl.findBodyNo(newCos); newCos.id = chaTbl.lastCosId + 1; foreach (ItemBean i in newCos.item) { if (Int32.Parse(i.item) == OldBodyno) { i.item = (chaTbl.lastItemNo + 1).ToString(); } } chaTbl.addCos(newCos); logs.modules.Add(new ModuleLogBean(modules.findModuleById(moduleId), mb, chaTbl.findCosById(oriCosId), newCos)); //新增身体 CharacterItemBean newItem = copyItemByNo(mb.chara, OldBodyno); //更新缩略图 String spiritName = sprdb.addMD(mb.id); //更新日志 }