// ------------------------------------------------------------------------------- // Save // ------------------------------------------------------------------------------- public override BaseDataTable Save() { BaseDataTable data = new BaseDataTable(); data.AddString(DatabaseManager.fieldName, sActorName); data.AddString(DatabaseManager.fieldId, sAccountName); data.AddBool(DatabaseManager.fieldBanned, bBanned); data.AddBool(DatabaseManager.fieldDeleted, bDeleted); return(data); }
// ------------------------------------------------------------------------------- // Save // ------------------------------------------------------------------------------- public override BaseDataTable Save() { BaseDataTable data = new BaseDataTable(); for (int i = 0; i < syncAttributes.Count; ++i) { data.AddString(DatabaseManager.fieldName, parent.name, i); data.AddString(DatabaseManager.fieldId, syncAttributes[i].name, i); data.AddInt(DatabaseManager.fieldValue, syncAttributes[i].nValue, i); } return(data); }
// ------------------------------------------------------------------------------- // Load // ------------------------------------------------------------------------------- public void Load(BaseDataTable data) { sName = data.GetString(DatabaseManager.fieldName); sPassword = data.GetString(DatabaseManager.fieldPassword); sMail = data.GetString(DatabaseManager.fieldEmail); _nAction = data.GetLongAsInt(DatabaseManager.fieldAction); sDeviceId = data.GetString(DatabaseManager.fieldDeviceId); bBanned = data.GetBoolFromInt(DatabaseManager.fieldBanned); bDeleted = data.GetBoolFromInt(DatabaseManager.fieldDeleted); bConfirmed = data.GetBoolFromInt(DatabaseManager.fieldConfirmed); bDone = data.GetBoolFromInt(DatabaseManager.fieldDone); nCode = data.GetLongAsInt(DatabaseManager.fieldCode); }
// ------------------------------------------------------------------------------- // Save // ------------------------------------------------------------------------------- public override BaseDataTable Save() { BaseDataTable data = new BaseDataTable(); for (int i = 0; i < syncStatus.Count; ++i) { data.AddString(DatabaseManager.fieldName, parent.name, i); data.AddString(DatabaseManager.fieldId, syncStatus[i].name, i); data.AddInt(DatabaseManager.fieldLevel, syncStatus[i].nLevel, i); data.AddDouble(DatabaseManager.fieldDuration, syncStatus[i].dTimer, i); } return(data); }
// ------------------------------------------------------------------------------- // ActorPlayerLoad // ------------------------------------------------------------------------------- public GameObject ActorPlayerLoad(string sName) { if (String.IsNullOrWhiteSpace(sName) || !databaseProvider.RowExists(tableActorPlayers, fieldName, sName).Result ) { return(null); } GameObject actorObject = null; BaseDataTable data = databaseProvider.LoadAspects(sName).Result; // -- load the required prefab via the actors aspects for (int i = 0; i < data.Rows.Count; ++i) { TemplateAspect tmpl; if (DataManager.dictAspect.TryGetValue(data.GetIdHash(i), out tmpl)) { if (tmpl.actorPrefab) { actorObject = tmpl.actorPrefab; break; } } else { Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library."); } } actorObject.GetComponent <MetaSubsystem>().Load(databaseProvider.LoadMeta(sName).Result); actorObject.GetComponent <AlignmentSubsystem>().Load(databaseProvider.LoadAlignments(sName).Result); actorObject.GetComponent <AspectSubsystem>().Load(databaseProvider.LoadAspects(sName).Result); actorObject.GetComponent <ProfessionSubsystem>().Load(databaseProvider.LoadProfessions(sName).Result); actorObject.GetComponent <AttributeSubsystem>().Load(databaseProvider.LoadAttributes(sName).Result); actorObject.GetComponent <CurrencySubsystem>().Load(databaseProvider.LoadCurrencies(sName).Result); actorObject.GetComponent <EnergySubsystem>().Load(databaseProvider.LoadEnergies(sName).Result); actorObject.GetComponent <EquipmentSubsystem>().Load(databaseProvider.LoadEquipment(sName).Result); actorObject.GetComponent <InventorySubsystem>().Load(databaseProvider.LoadInventory(sName).Result); actorObject.GetComponent <SkillSubsystem>().Load(databaseProvider.LoadSkills(sName).Result); actorObject.GetComponent <StatusSubsystem>().Load(databaseProvider.LoadStatus(sName).Result); return(actorObject); }
// ------------------------------------------------------------------------------- // Save // ------------------------------------------------------------------------------- public BaseDataTable Save() { BaseDataTable data = new BaseDataTable(); data.AddString(DatabaseManager.fieldName, sName); data.AddString(DatabaseManager.fieldPassword, sPassword); data.AddString(DatabaseManager.fieldEmail, sMail); data.AddInt(DatabaseManager.fieldAction, _nAction); data.AddString(DatabaseManager.fieldDeviceId, sDeviceId); data.AddBool(DatabaseManager.fieldBanned, bBanned); data.AddBool(DatabaseManager.fieldDeleted, bDeleted); data.AddBool(DatabaseManager.fieldConfirmed, bConfirmed); data.AddBool(DatabaseManager.fieldDone, bDone); data.AddInt(DatabaseManager.fieldCode, nCode); return(data); }
// ------------------------------------------------------------------------------- // Save // ------------------------------------------------------------------------------- public override BaseDataTable Save() { BaseDataTable data = new BaseDataTable(); for (int i = 0; i < syncInventory.Count; ++i) { data.AddString(DatabaseManager.fieldName, parent.name, i); data.AddString(DatabaseManager.fieldId, syncInventory[i].name, i); data.AddInt(DatabaseManager.fieldId, syncInventory[i].nSlot, i); data.AddInt(DatabaseManager.fieldId, syncInventory[i].nAmount, i); data.AddInt(DatabaseManager.fieldId, syncInventory[i].nAmmo, i); data.AddInt(DatabaseManager.fieldId, syncInventory[i].nCharges, i); data.AddInt(DatabaseManager.fieldLevel, syncInventory[i].nLevel, i); } return(data); }
// ------------------------------------------------------------------------------- // Load // ------------------------------------------------------------------------------- public override void Load(BaseDataTable data) { syncAttributes.Clear(); for (int i = 0; i < data.Rows.Count; ++i) { TemplateAttribute tmpl; if (DataManager.dictAttribute.TryGetValue(data.GetIdHash(i), out tmpl)) { SAttribute sAttribute = new SAttribute(tmpl.GetId, data.GetLongAsInt(DatabaseManager.fieldValue, i)); syncAttributes.Add(sAttribute); } else { Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library."); } } data.Cleanup(); }
// ------------------------------------------------------------------------------- // Load // ------------------------------------------------------------------------------- public override void Load(BaseDataTable data) { syncInventory.Clear(); for (int i = 0; i < data.Rows.Count; ++i) { TemplateItem tmpl; if (DataManager.dictItem.TryGetValue(data.GetIdHash(i), out tmpl)) { SItem sItem = new SItem(tmpl.GetId, data.GetLongAsInt(DatabaseManager.fieldSlot, i), data.GetLongAsInt(DatabaseManager.fieldAmount, i), data.GetLongAsInt(DatabaseManager.fieldAmmo, i), data.GetLongAsInt(DatabaseManager.fieldCharges, i), data.GetLongAsInt(DatabaseManager.fieldLevel, i)); syncInventory.Add(sItem); } else { Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library."); } } data.Cleanup(); }
// ------------------------------------------------------------------------------- // Load // ------------------------------------------------------------------------------- public override void Load(BaseDataTable data) { syncStatus.Clear(); for (int i = 0; i < data.Rows.Count; ++i) { TemplateStatus tmpl; if (DataManager.dictStatus.TryGetValue(data.GetIdHash(i), out tmpl)) { SStatus sStatus = new SStatus(tmpl.GetId, data.GetLongAsInt(DatabaseManager.fieldLevel, i), data.GetDouble(DatabaseManager.fieldDuration, i)); syncStatus.Add(sStatus); } else { Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library."); } } data.Cleanup(); }
// =============================================================================== // ACCOUNT RELATED // =============================================================================== // ------------------------------------------------------------------------------- // AccountLoad // ------------------------------------------------------------------------------- public CAccount AccountLoad(string sName) { CAccount cAccount = null; if (String.IsNullOrWhiteSpace(sName)) { return(cAccount); } if (!String.IsNullOrWhiteSpace(sName) && databaseProvider.RowExists(tableAccounts, fieldName, sName).Result) { BaseDataTable data = databaseProvider.LoadAccount(sName).Result; if (data != null) { cAccount = new CAccount(); cAccount.Load(data); } } return(cAccount); }
// ------------------------------------------------------------------------------- // Load // ------------------------------------------------------------------------------- public abstract void Load(BaseDataTable data);
// ------------------------------------------------------------------------------- // // ------------------------------------------------------------------------------- public bool AccountModify(string sName, BaseDataTable data, int nCode = 0) { return(true); }
// ------------------------------------------------------------------------------- // Load // ------------------------------------------------------------------------------- public override void Load(BaseDataTable data) { }