public async UniTaskVoid IncreaseGuildExp(IPlayerCharacterData playerCharacter, int exp) { #if UNITY_STANDALONE && !CLIENT_BUILD ValidateGuildRequestResult validateResult = this.CanIncreaseGuildExp(playerCharacter, exp); if (!validateResult.IsSuccess) { return; } AsyncResponseData <GuildResp> resp = await DbServiceClient.IncreaseGuildExpAsync(new IncreaseGuildExpReq() { GuildId = validateResult.GuildId, Exp = exp, }); if (!resp.IsSuccess) { return; } GuildData guild = resp.Response.GuildData; SetGuild(validateResult.GuildId, guild); // Broadcast via chat server if (ClusterClient.IsNetworkActive) { ClusterClient.SendSetGuildLevelExpSkillPoint(MMOMessageTypes.UpdateGuild, guild.id, guild.level, guild.exp, guild.skillPoint); } GameInstance.ServerGameMessageHandlers.SendSetGuildLevelExpSkillPointToMembers(guild); #endif }
private static void RepairItem(IPlayerCharacterData character, CharacterItem repairingItem, System.Action <CharacterItem> onRepaired, out GameMessage.Type gameMessageType) { gameMessageType = GameMessage.Type.CannotRepair; if (!repairingItem.NotEmptySlot()) { // Cannot refine because character item is empty return; } Item equipmentItem = repairingItem.GetEquipmentItem(); if (equipmentItem == null) { // Cannot refine because it's not equipment item return; } ItemRepairPrice repairPrice; if (equipmentItem.CanRepair(character, repairingItem.durability, out repairPrice, out gameMessageType)) { gameMessageType = GameMessage.Type.RepairSuccess; // Repair item repairingItem.durability = equipmentItem.maxDurability; onRepaired.Invoke(repairingItem); // Decrease required gold GameInstance.Singleton.GameplayRule.DecreaseCurrenciesWhenRepairItem(character, repairPrice); } }
public static bool CanLevelUp(this Skill skill, IPlayerCharacterData character, short level) { if (skill == null || character == null) { return(false); } var isPass = true; var skillLevelsDict = new Dictionary <Skill, int>(); var skillLevels = character.Skills; foreach (var skillLevel in skillLevels) { if (skillLevel.GetSkill() == null) { continue; } skillLevelsDict[skillLevel.GetSkill()] = skillLevel.level; } var requireSkillLevels = skill.CacheRequireSkillLevels; foreach (var requireSkillLevel in requireSkillLevels) { if (!skillLevelsDict.ContainsKey(requireSkillLevel.Key) || skillLevelsDict[requireSkillLevel.Key] < requireSkillLevel.Value) { isPass = false; break; } } return(character.SkillPoint > 0 && level < skill.maxLevel && character.Level >= skill.GetRequireCharacterLevel(level) && isPass); }
private static void RepairItemByList(IPlayerCharacterData character, IList <CharacterItem> list, int index, out GameMessage.Type gameMessageType) { RepairItem(character, list[index], (repairedItem) => { list[index] = repairedItem; }, out gameMessageType); }
public async UniTaskVoid OpenStorage(long connectionId, IPlayerCharacterData playerCharacter, StorageId storageId) { #if UNITY_STANDALONE && !CLIENT_BUILD if (!CanAccessStorage(playerCharacter, storageId)) { GameInstance.ServerGameMessageHandlers.SendGameMessage(connectionId, UITextKeys.UI_ERROR_CANNOT_ACCESS_STORAGE); return; } // Store storage usage states if (!usingStorageClients.ContainsKey(storageId)) { usingStorageClients.TryAdd(storageId, new HashSet <long>()); } usingStorageClients[storageId].Add(connectionId); usingStorageIds.TryRemove(connectionId, out _); usingStorageIds.TryAdd(connectionId, storageId); // Load storage items from database ReadStorageItemsReq req = new ReadStorageItemsReq(); req.StorageType = (EStorageType)storageId.storageType; req.StorageOwnerId = storageId.storageOwnerId; ReadStorageItemsResp resp = await DbServiceClient.ReadStorageItemsAsync(req); List <CharacterItem> storageItems = DatabaseServiceUtils.MakeListFromRepeatedByteString <CharacterItem>(resp.StorageCharacterItems); SetStorageItems(storageId, storageItems); // Notify storage items to client uint storageObjectId; Storage storage = GetStorage(storageId, out storageObjectId); GameInstance.ServerGameMessageHandlers.NotifyStorageOpened(connectionId, storageId.storageType, storageId.storageOwnerId, storageObjectId, storage.weightLimit, storage.slotLimit); storageItems.FillEmptySlots(storage.slotLimit > 0, storage.slotLimit); GameInstance.ServerGameMessageHandlers.NotifyStorageItems(connectionId, storageItems); #endif }
public bool CanAccessStorage(IPlayerCharacterData playerCharacter, StorageId storageId) { switch (storageId.storageType) { case StorageType.Player: if (!playerCharacter.UserId.Equals(storageId.storageOwnerId)) { return(false); } break; case StorageType.Guild: if (!GameInstance.ServerGuildHandlers.ContainsGuild(playerCharacter.GuildId) || !playerCharacter.GuildId.ToString().Equals(storageId.storageOwnerId)) { return(false); } break; case StorageType.Building: StorageEntity buildingEntity; if (!GameInstance.ServerBuildingHandlers.TryGetBuilding(storageId.storageOwnerId, out buildingEntity) || !(buildingEntity.IsCreator(playerCharacter.Id) || buildingEntity.CanUseByEveryone)) { return(false); } break; } return(true); }
protected virtual void OnClickStart() { UICharacter selectedUI = CacheCharacterSelectionManager.SelectedUI; if (selectedUI == null) { UISceneGlobal.Singleton.ShowMessageDialog(LanguageManager.GetText(UILocaleKeys.UI_LABEL_ERROR.ToString()), LanguageManager.GetText(UILocaleKeys.UI_ERROR_NO_CHOSEN_CHARACTER_TO_START.ToString())); Debug.LogWarning("Cannot start game, No chosen character"); return; } // Load gameplay scene, we're going to manage maps in gameplay scene later // So we can add gameplay UI just once in gameplay scene PlayerCharacterData characterData = new PlayerCharacterData(); IPlayerCharacterData playerCharacter = selectedUI.Data as IPlayerCharacterData; playerCharacter.CloneTo(characterData); GameInstance gameInstance = GameInstance.Singleton; LanRpgNetworkManager networkManager = BaseGameNetworkManager.Singleton as LanRpgNetworkManager; if (!gameInstance.GetGameMapIds().Contains(characterData.CurrentMapName)) { MapInfo startMap = (characterData.GetDatabase() as PlayerCharacter).StartMap; characterData.CurrentMapName = startMap.Id; characterData.CurrentPosition = startMap.startPosition; } networkManager.Assets.onlineScene.SceneName = characterData.CurrentMapName; networkManager.selectedCharacter = characterData; networkManager.StartGame(); }
private void FillCharacterSummons(IPlayerCharacterData characterData) { MySqlConnection connection = NewConnection(); connection.Open(); MySqlTransaction transaction = connection.BeginTransaction(); try { DeleteCharacterSummons(connection, transaction, characterData.Id); int i = 0; foreach (CharacterSummon skillUsage in characterData.Summons) { CreateCharacterSummon(connection, transaction, i++, characterData.Id, skillUsage); } transaction.Commit(); } catch (System.Exception ex) { Debug.LogError("Transaction, Error occurs while replacing skill usages of character: " + characterData.Id); Debug.LogException(ex); transaction.Rollback(); } transaction.Dispose(); connection.Close(); }
protected override void OnSelectCharacter(IPlayerCharacterData playerCharacterData) { if (buttonStart) { buttonStart.gameObject.SetActive(true); } if (buttonDelete) { buttonDelete.gameObject.SetActive(true); } characterModelContainer.SetChildrenActive(false); // Load selected character, set selected player character data and also validate its data PlayerCharacterDataById.TryGetValue(playerCharacterData.Id, out selectedPlayerCharacterData); // Validate map data if (!GameInstance.Singleton.GetGameMapIds().Contains(SelectedPlayerCharacterData.CurrentMapName)) { PlayerCharacter database = SelectedPlayerCharacterData.GetDatabase() as PlayerCharacter; SelectedPlayerCharacterData.CurrentMapName = database.StartMap.Id; SelectedPlayerCharacterData.CurrentPosition = database.StartPosition; } // Set selected character to network manager (BaseGameNetworkManager.Singleton as LanRpgNetworkManager).selectedCharacter = SelectedPlayerCharacterData; // Show selected character model CharacterModelById.TryGetValue(playerCharacterData.Id, out selectedModel); if (SelectedModel != null && SelectedModel is ICharacterModelUma) { // Setup Uma model and applies options ICharacterModelUma characterModelUMA = SelectedModel as ICharacterModelUma; UmaModel = characterModelUMA; SelectedModel.gameObject.SetActive(true); UmaModel.ApplyUmaAvatar(SelectedPlayerCharacterData.UmaAvatarData); } }
private void FillCharacterItems(IPlayerCharacterData characterData) { MySqlConnection connection = NewConnection(); connection.Open(); MySqlTransaction transaction = connection.BeginTransaction(); try { DeleteCharacterItems(connection, transaction, characterData.Id); int i; for (i = 0; i < characterData.SelectableWeaponSets.Count; ++i) { CreateCharacterEquipWeapons(connection, transaction, (byte)i, characterData.Id, characterData.SelectableWeaponSets[i]); } for (i = 0; i < characterData.EquipItems.Count; ++i) { CreateCharacterEquipItem(connection, transaction, i, characterData.Id, characterData.EquipItems[i]); } for (i = 0; i < characterData.NonEquipItems.Count; ++i) { CreateCharacterNonEquipItem(connection, transaction, i, characterData.Id, characterData.NonEquipItems[i]); } transaction.Commit(); } catch (System.Exception ex) { Debug.LogError("Transaction, Error occurs while replacing items of character: " + characterData.Id); Debug.LogException(ex); transaction.Rollback(); } transaction.Dispose(); connection.Close(); }
public void UpdateData(IPlayerCharacterData character) { this.character = character; int selectedQuestId = CacheQuestSelectionManager.SelectedUI != null ? CacheQuestSelectionManager.SelectedUI.Data.dataId : 0; CacheQuestSelectionManager.DeselectSelectedUI(); CacheQuestSelectionManager.Clear(); List <CharacterQuest> characterQuests = new List <CharacterQuest>(); foreach (CharacterQuest characterQuest in character.Quests) { if (HideCompleteQuest || characterQuest.isComplete) { continue; } characterQuests.Add(characterQuest); } CacheQuestList.Generate(characterQuests, (index, characterQuest, ui) => { UICharacterQuest uiCharacterQuest = ui.GetComponent <UICharacterQuest>(); uiCharacterQuest.Setup(characterQuest, character, index); uiCharacterQuest.Show(); CacheQuestSelectionManager.Add(uiCharacterQuest); if (selectedQuestId == characterQuest.dataId) { uiCharacterQuest.OnClickSelect(); } }); }
private void FillCharacterAttributes(IPlayerCharacterData characterData) { MySqlConnection connection = NewConnection(); connection.Open(); MySqlTransaction transaction = connection.BeginTransaction(); try { DeleteCharacterAttributes(connection, transaction, characterData.Id); int i; for (i = 0; i < characterData.Attributes.Count; ++i) { CreateCharacterAttribute(connection, transaction, i, characterData.Id, characterData.Attributes[i]); } transaction.Commit(); } catch (System.Exception ex) { Debug.LogError("Transaction, Error occurs while replacing attributes of character: " + characterData.Id); Debug.LogException(ex); transaction.Rollback(); } transaction.Dispose(); connection.Close(); }
private static void EnhanceSocketItemByList(IPlayerCharacterData character, IList <CharacterItem> list, int index, int enhancerId, out GameMessage.Type gameMessageType) { EnhanceSocketItem(character, list[index], enhancerId, (enhancedSocketItem) => { list[index] = enhancedSocketItem; }, out gameMessageType); }
private async UniTask FillCharacterHotkeys(IPlayerCharacterData characterData) { MySqlConnection connection = NewConnection(); await OpenConnection(connection); MySqlTransaction transaction = await connection.BeginTransactionAsync(); try { await DeleteCharacterHotkeys(connection, transaction, characterData.Id); int i; for (i = 0; i < characterData.Hotkeys.Count; ++i) { await CreateCharacterHotkey(connection, transaction, characterData.Id, characterData.Hotkeys[i]); } await transaction.CommitAsync(); } catch (System.Exception ex) { Logging.LogError(ToString(), "Transaction, Error occurs while replacing hotkeys of character: " + characterData.Id); Logging.LogException(ToString(), ex); await transaction.RollbackAsync(); } await transaction.DisposeAsync(); await connection.CloseAsync(); }
private void FillCharacterBuffs(IPlayerCharacterData characterData) { MySqlConnection connection = NewConnection(); connection.Open(); MySqlTransaction transaction = connection.BeginTransaction(); try { DeleteCharacterBuffs(connection, transaction, characterData.Id); foreach (CharacterBuff buff in characterData.Buffs) { CreateCharacterBuff(connection, transaction, characterData.Id, buff); } transaction.Commit(); } catch (System.Exception ex) { Debug.LogError("Transaction, Error occurs while replacing buffs of character: " + characterData.Id); Debug.LogException(ex); transaction.Rollback(); } transaction.Dispose(); connection.Close(); }
private void FillCharacterItems(IPlayerCharacterData characterData) { var connection = NewConnection(); connection.Open(); var transaction = connection.BeginTransaction(); try { DeleteCharacterItems(connection, transaction, characterData.Id); CreateCharacterEquipWeapons(connection, transaction, characterData.Id, characterData.EquipWeapons); var i = 0; foreach (var equipItem in characterData.EquipItems) { CreateCharacterEquipItem(connection, transaction, i++, characterData.Id, equipItem); } i = 0; foreach (var nonEquipItem in characterData.NonEquipItems) { CreateCharacterNonEquipItem(connection, transaction, i++, characterData.Id, nonEquipItem); } transaction.Commit(); } catch (System.Exception ex) { Debug.LogError("Transaction, Error occurs while replacing items of character: " + characterData.Id); Debug.LogException(ex); transaction.Rollback(); } transaction.Dispose(); connection.Close(); }
private void FillCharacterAttributes(IPlayerCharacterData characterData) { var connection = NewConnection(); connection.Open(); var transaction = connection.BeginTransaction(); try { DeleteCharacterAttributes(connection, transaction, characterData.Id); var i = 0; foreach (var attribute in characterData.Attributes) { CreateCharacterAttribute(connection, transaction, i++, characterData.Id, attribute); } transaction.Commit(); } catch (System.Exception ex) { Debug.LogError("Transaction, Error occurs while replacing attributes of character: " + characterData.Id); Debug.LogException(ex); transaction.Rollback(); } transaction.Dispose(); connection.Close(); }
public override void CreateCharacter(string userId, IPlayerCharacterData characterData) { ExecuteNonQuery("INSERT INTO characters " + "(id, userId, dataId, entityId, characterName, level, exp, currentHp, currentMp, currentStamina, currentFood, currentWater, statPoint, skillPoint, gold, currentMapName, currentPositionX, currentPositionY, currentPositionZ, respawnMapName, respawnPositionX, respawnPositionY, respawnPositionZ) VALUES " + "(@id, @userId, @dataId, @entityId, @characterName, @level, @exp, @currentHp, @currentMp, @currentStamina, @currentFood, @currentWater, @statPoint, @skillPoint, @gold, @currentMapName, @currentPositionX, @currentPositionY, @currentPositionZ, @respawnMapName, @respawnPositionX, @respawnPositionY, @respawnPositionZ)", new MySqlParameter("@id", characterData.Id), new MySqlParameter("@userId", userId), new MySqlParameter("@dataId", characterData.DataId), new MySqlParameter("@entityId", characterData.EntityId), new MySqlParameter("@characterName", characterData.CharacterName), new MySqlParameter("@level", characterData.Level), new MySqlParameter("@exp", characterData.Exp), new MySqlParameter("@currentHp", characterData.CurrentHp), new MySqlParameter("@currentMp", characterData.CurrentMp), new MySqlParameter("@currentStamina", characterData.CurrentStamina), new MySqlParameter("@currentFood", characterData.CurrentFood), new MySqlParameter("@currentWater", characterData.CurrentWater), new MySqlParameter("@statPoint", characterData.StatPoint), new MySqlParameter("@skillPoint", characterData.SkillPoint), new MySqlParameter("@gold", characterData.Gold), new MySqlParameter("@currentMapName", characterData.CurrentMapName), new MySqlParameter("@currentPositionX", characterData.CurrentPosition.x), new MySqlParameter("@currentPositionY", characterData.CurrentPosition.y), new MySqlParameter("@currentPositionZ", characterData.CurrentPosition.z), new MySqlParameter("@respawnMapName", characterData.RespawnMapName), new MySqlParameter("@respawnPositionX", characterData.RespawnPosition.x), new MySqlParameter("@respawnPositionY", characterData.RespawnPosition.y), new MySqlParameter("@respawnPositionZ", characterData.RespawnPosition.z)); FillCharacterRelatesData(characterData); this.InvokeInstanceDevExtMethods("CreateCharacter", userId, characterData); }
private void FillCharacterHotkeys(IPlayerCharacterData characterData) { var connection = NewConnection(); connection.Open(); var transaction = connection.BeginTransaction(); try { DeleteCharacterHotkeys(connection, transaction, characterData.Id); foreach (var hotkey in characterData.Hotkeys) { CreateCharacterHotkey(connection, transaction, characterData.Id, hotkey); } transaction.Commit(); } catch (System.Exception ex) { Debug.LogError("Transaction, Error occurs while replacing hotkeys of character: " + characterData.Id); Debug.LogException(ex); transaction.Rollback(); } transaction.Dispose(); connection.Close(); }
public static void DeserializeCharacterData_UMA(IPlayerCharacterData characterData, NetDataReader reader) { UmaAvatarData umaAvatarData = new UmaAvatarData(); umaAvatarData.Deserialize(reader); characterData.UmaAvatarData = umaAvatarData; }
public bool CanCraft(IPlayerCharacterData character, out GameMessage.Type gameMessageType) { gameMessageType = GameMessage.Type.None; if (craftingItem == null) { gameMessageType = GameMessage.Type.InvalidItemData; return(false); } if (character.Gold < requireGold) { gameMessageType = GameMessage.Type.NotEnoughGold; return(false); } if (craftRequirements == null || craftRequirements.Length == 0) { return(true); } foreach (var craftRequirement in craftRequirements) { if (craftRequirement.item != null && character.CountNonEquipItems(craftRequirement.item.DataId) < craftRequirement.amount) { gameMessageType = GameMessage.Type.NotEnoughItems; return(false); } } return(true); }
private void FillCharacterHotkeys(IPlayerCharacterData characterData) { MySqlConnection connection = NewConnection(); connection.Open(); MySqlTransaction transaction = connection.BeginTransaction(); try { DeleteCharacterHotkeys(connection, transaction, characterData.Id); int i; for (i = 0; i < characterData.Hotkeys.Count; ++i) { CreateCharacterHotkey(connection, transaction, characterData.Id, characterData.Hotkeys[i]); } transaction.Commit(); } catch (System.Exception ex) { Logging.LogError(ToString(), "Transaction, Error occurs while replacing hotkeys of character: " + characterData.Id); Logging.LogException(ToString(), ex); transaction.Rollback(); } transaction.Dispose(); connection.Close(); }
public void UpdateData(IPlayerCharacterData character) { this.character = character; var selectedQuestId = SelectionManager.SelectedUI != null ? SelectionManager.SelectedUI.Data.dataId : 0; SelectionManager.DeselectSelectedUI(); SelectionManager.Clear(); if (character == null) { CacheList.HideAll(); return; } var characterQuests = character.Quests; CacheList.Generate(characterQuests, (index, characterQuest, ui) => { var uiCharacterQuest = ui.GetComponent <UICharacterQuest>(); uiCharacterQuest.Setup(characterQuest, character, index); uiCharacterQuest.Show(); SelectionManager.Add(uiCharacterQuest); if (selectedQuestId.Equals(characterQuest.dataId)) { uiCharacterQuest.OnClickSelect(); } }); }
public bool CanCraft(IPlayerCharacterData character, out GameMessage.Type gameMessageType) { gameMessageType = GameMessage.Type.None; if (craftingItem == null) { gameMessageType = GameMessage.Type.InvalidItemData; return(false); } if (!GameInstance.Singleton.GameplayRule.CurrenciesEnoughToCraftItem(character, this)) { gameMessageType = GameMessage.Type.NotEnoughGold; return(false); } if (craftRequirements == null || craftRequirements.Length == 0) { // No required items return(true); } foreach (ItemAmount craftRequirement in craftRequirements) { if (craftRequirement.item != null && character.CountNonEquipItems(craftRequirement.item.DataId) < craftRequirement.amount) { gameMessageType = GameMessage.Type.NotEnoughItems; return(false); } } return(true); }
public bool CanRepair(IPlayerCharacterData character, float durability, out ItemRepairPrice repairPrice, out GameMessage.Type gameMessageType) { repairPrice = default(ItemRepairPrice); gameMessageType = GameMessage.Type.CannotRepair; if (!IsEquipment()) { // Cannot repair because it's not equipment item return(false); } if (itemRefine == null) { // Cannot repair because there is no item refine info return(false); } float durabilityRate = durability / maxDurability; for (int i = 0; i < itemRefine.repairPrices.Length; ++i) { repairPrice = itemRefine.repairPrices[i]; if (durabilityRate < repairPrice.DurabilityRate) { return(repairPrice.CanRepair(character, out gameMessageType)); } } return(true); }
private void FillCharacterRelatesData(IPlayerCharacterData characterData) { // Delete all character then add all of them string characterId = characterData.Id; DeleteCharacterAttributes(characterId); DeleteCharacterBuffs(characterId); DeleteCharacterHotkeys(characterId); DeleteCharacterItems(characterId); DeleteCharacterQuests(characterId); DeleteCharacterSkills(characterId); DeleteCharacterSkillUsages(characterId); DeleteCharacterSummons(characterId); CreateCharacterEquipWeapons(characterId, characterData.EquipWeapons); int i = 0; foreach (CharacterItem equipItem in characterData.EquipItems) { CreateCharacterEquipItem(i++, characterId, equipItem); } i = 0; foreach (CharacterItem nonEquipItem in characterData.NonEquipItems) { CreateCharacterNonEquipItem(i++, characterId, nonEquipItem); } i = 0; foreach (CharacterAttribute attribute in characterData.Attributes) { CreateCharacterAttribute(i++, characterId, attribute); } i = 0; foreach (CharacterSkill skill in characterData.Skills) { CreateCharacterSkill(i++, characterId, skill); } foreach (CharacterSkillUsage skillUsage in characterData.SkillUsages) { CreateCharacterSkillUsage(characterId, skillUsage); } i = 0; foreach (CharacterSummon summon in characterData.Summons) { CreateCharacterSummon(i++, characterId, summon); } i = 0; foreach (CharacterQuest quest in characterData.Quests) { CreateCharacterQuest(i++, characterId, quest); } foreach (CharacterBuff buff in characterData.Buffs) { CreateCharacterBuff(characterId, buff); } foreach (CharacterHotkey hotkey in characterData.Hotkeys) { CreateCharacterHotkey(characterId, hotkey); } }
public override void UpdateCharacter(IPlayerCharacterData character) { BeginTransaction(); ExecuteNonQuery("UPDATE characters SET " + "dataId=@dataId, " + "entityId=@entityId, " + "factionId=@factionId, " + "characterName=@characterName, " + "level=@level, " + "exp=@exp, " + "currentHp=@currentHp, " + "currentMp=@currentMp, " + "currentStamina=@currentStamina, " + "currentFood=@currentFood, " + "currentWater=@currentWater, " + "equipWeaponSet=@equipWeaponSet, " + "statPoint=@statPoint, " + "skillPoint=@skillPoint, " + "gold=@gold, " + "currentMapName=@currentMapName, " + "currentPositionX=@currentPositionX, " + "currentPositionY=@currentPositionY, " + "currentPositionZ=@currentPositionZ, " + "respawnMapName=@respawnMapName, " + "respawnPositionX=@respawnPositionX, " + "respawnPositionY=@respawnPositionY, " + "respawnPositionZ=@respawnPositionZ, " + "mountDataId=@mountDataId " + "WHERE id=@id", new SqliteParameter("@dataId", character.DataId), new SqliteParameter("@entityId", character.EntityId), new SqliteParameter("@factionId", character.FactionId), new SqliteParameter("@characterName", character.CharacterName), new SqliteParameter("@level", character.Level), new SqliteParameter("@exp", character.Exp), new SqliteParameter("@currentHp", character.CurrentHp), new SqliteParameter("@currentMp", character.CurrentMp), new SqliteParameter("@currentStamina", character.CurrentStamina), new SqliteParameter("@currentFood", character.CurrentFood), new SqliteParameter("@currentWater", character.CurrentWater), new SqliteParameter("@equipWeaponSet", character.EquipWeaponSet), new SqliteParameter("@statPoint", character.StatPoint), new SqliteParameter("@skillPoint", character.SkillPoint), new SqliteParameter("@gold", character.Gold), new SqliteParameter("@currentMapName", character.CurrentMapName), new SqliteParameter("@currentPositionX", character.CurrentPosition.x), new SqliteParameter("@currentPositionY", character.CurrentPosition.y), new SqliteParameter("@currentPositionZ", character.CurrentPosition.z), new SqliteParameter("@respawnMapName", character.RespawnMapName), new SqliteParameter("@respawnPositionX", character.RespawnPosition.x), new SqliteParameter("@respawnPositionY", character.RespawnPosition.y), new SqliteParameter("@respawnPositionZ", character.RespawnPosition.z), new SqliteParameter("@mountDataId", character.MountDataId), new SqliteParameter("@id", character.Id)); FillCharacterRelatesData(character); this.InvokeInstanceDevExtMethods("UpdateCharacter", character); EndTransaction(); }
private void FillCharacterRelatesData(IPlayerCharacterData characterData) { // Delete all character then add all of them string characterId = characterData.Id; DeleteCharacterAttributes(characterId); DeleteCharacterBuffs(characterId); DeleteCharacterHotkeys(characterId); DeleteCharacterItems(characterId); DeleteCharacterQuests(characterId); DeleteCharacterSkills(characterId); DeleteCharacterSkillUsages(characterId); DeleteCharacterSummons(characterId); int i; for (i = 0; i < characterData.SelectableWeaponSets.Count; ++i) { CreateCharacterEquipWeapons((byte)i, characterData.Id, characterData.SelectableWeaponSets[i]); } for (i = 0; i < characterData.EquipItems.Count; ++i) { CreateCharacterEquipItem(i, characterData.Id, characterData.EquipItems[i]); } for (i = 0; i < characterData.NonEquipItems.Count; ++i) { CreateCharacterNonEquipItem(i, characterData.Id, characterData.NonEquipItems[i]); } for (i = 0; i < characterData.Attributes.Count; ++i) { CreateCharacterAttribute(i, characterData.Id, characterData.Attributes[i]); } for (i = 0; i < characterData.Skills.Count; ++i) { CreateCharacterSkill(i, characterData.Id, characterData.Skills[i]); } for (i = 0; i < characterData.SkillUsages.Count; ++i) { CreateCharacterSkillUsage(characterData.Id, characterData.SkillUsages[i]); } for (i = 0; i < characterData.Summons.Count; ++i) { CreateCharacterSummon(i, characterData.Id, characterData.Summons[i]); } for (i = 0; i < characterData.Quests.Count; ++i) { CreateCharacterQuest(i, characterData.Id, characterData.Quests[i]); } for (i = 0; i < characterData.Buffs.Count; ++i) { CreateCharacterBuff(characterData.Id, characterData.Buffs[i]); } for (i = 0; i < characterData.Hotkeys.Count; ++i) { CreateCharacterHotkey(characterData.Id, characterData.Hotkeys[i]); } }
private void FillCharacterRelatesData(IPlayerCharacterData characterData) { FillCharacterAttributes(characterData); FillCharacterBuffs(characterData); FillCharacterHotkeys(characterData); FillCharacterItems(characterData); FillCharacterQuests(characterData); FillCharacterSkills(characterData); }
public static void EnhanceSocketRightHandItem(IPlayerCharacterData character, int enhancerId, out GameMessage.Type gameMessageType) { EnhanceSocketItem(character, character.EquipWeapons.rightHand, enhancerId, (enhancedSocketItem) => { EquipWeapons equipWeapon = character.EquipWeapons; equipWeapon.rightHand = enhancedSocketItem; character.EquipWeapons = equipWeapon; }, out gameMessageType); }