public void Load() { Start(); log.InfoFormat("ShipWeapon Load() [dy]"); var character = GetComponent <CharacterObject>(); var dropManager = DropManager.Get(nebulaObject.world.Resource()); var player = GetComponent <MmoActor>(); var app = nebulaObject.mmoWorld().application; bool isNew = false; var dbWeapon = WeaponDatabase.instance(app).LoadWeapon(player.GetComponent <PlayerCharacterObject>().characterId, resource as Res, out isNew); if (isNew) { GenerateNewWeapon(dropManager); string characterID = GetComponent <PlayerCharacterObject>().characterId; WeaponDatabase.instance(app).SaveWeapon(characterID, new ShipWeaponSave { characterID = characterID, weaponObject = weaponObject.GetInfo() }); } else { weaponObject = new WeaponObject(dbWeapon.weaponObject); } }
public void Save(bool forceSaveToDB) { if (mLoaded) { if (player == null) { return; } var character = GetComponent <PlayerCharacterObject>(); if (character == null) { return; } try { var app = nebulaObject.mmoWorld().application; InventoryDatabase.instance(app).SaveInventory(character.characterId, player.Inventory); StationDatabase.instance(app).SaveStation(character.characterId, player.Station); CharacterDatabase.instance(app).SaveCharacter(character.characterId, player.GetPlayerCharacter()); ShipModelDatabase.instance(app).SaveShipModel(character.characterId, GetComponent <PlayerShip>().shipModel); SkillDatabase.instance(app).SaveSkills(character.characterId, GetComponent <PlayerSkills>().GetSave()); WeaponDatabase.instance(app).SaveWeapon(character.characterId, player.GetComponent <ShipWeapon>().GetSave()); PassiveBonusesDatabase.instance(app).SavePassiveBonuses(character.characterId, player.GetComponent <PassiveBonusesComponent>().GetSave()); TimedEffectsDatabase.instance(app).SaveTimedEffects(character.characterId, player.GetComponent <PlayerTimedEffects>().GetInfo()); PetDatabase.instance(app).SavePets(character.characterId, player.GetComponent <PetManager>().pets); ContractDatabase.instance(app).SaveContracts(character.characterId, player.GetComponent <ContractManager>().GetSave()); AchievmentDatabase.instance(app).SaveAchievment(character.characterId, player.GetComponent <AchievmentComponent>().GetSave()); QuestDatabase.instance(app).SaveQuests(character.characterId, player.GetComponent <QuestManager>().GetSave()); //QuestDatabase.instance(app).SaveQuests(character.characterId, player.GetComponent<QuestManager>().GetInfo()); //DialogDatabase.instance(app).SaveDialogs(character.characterId, player.GetComponent<DialogManager>().GetInfo()); } catch (Exception exception) { log.Error("handled exception at Player Loaded Object"); log.Error(exception.Message); log.Error(exception.StackTrace); } } }