// ----------------------------------------------------------------------------------- // UCE_CalculateWeight // ----------------------------------------------------------------------------------- protected void UCE_CalculateWeight() { totalWeight = 0; #if _iMMOATTRIBUTES if (weightSystem.weightAttribute != null) { UCE_Attribute attrib = playerAttributes.UCE_Attributes.FirstOrDefault(x => x.template == weightSystem.weightAttribute); maxWeight = weightSystem.carryPerPoint + ((attrib.points + playerAttributes.UCE_calculateBonusAttribute(attrib)) * weightSystem.carryPerPoint); } #endif for (int i = 0; i < inventory.slots.Count; ++i) { ItemSlot slot = inventory.slots[i]; if (slot.amount > 0) { totalWeight += slot.item.data.weight * slot.amount; } } for (int i = 0; i < equipment.slots.Count; ++i) { ItemSlot slot = equipment.slots[i]; if (slot.amount > 0) { totalWeight += slot.item.data.weight * slot.amount; } } }
public void Cmd_UCE_IncreaseAttribute(int index) { // validate. // If we have health and we have greater than zero spendable points and we can see the attribute passed over, increment it if (isAlive && UCE_AttributesSpendable() > 0 && 0 <= index && index < playerAttributes.UCE_Attributes.Count()) { UCE_Attribute attr = playerAttributes.UCE_Attributes[index]; attr.points += 1; playerAttributes.UCE_Attributes[index] = attr; } }
// ----------------------------------------------------------------------------------- // setBonusAttributeComplete // ----------------------------------------------------------------------------------- #if _iMMOATTRIBUTES public int setBonusAttributeComplete(ItemSlot slot, SyncListItemSlot equipment, UCE_Attribute attribute) { int iPoints = 0; // -- Complete Bonus (Applied Once) if (slot.amount > 0 && UCE_hasCompleteSetBonus() && UCE_validCompleteSetBonus(equipment)) { foreach (UCE_AttributeModifier modifier in ((EquipmentItem)data).equipmentSet.completeStatModifiers.UCE_AttributeModifiers) { if (modifier.template == attribute.template) { iPoints += Convert.ToInt32(attribute.points * modifier.percentBonus); iPoints += modifier.flatBonus; break; } } } return(iPoints); }
private void CharacterLoad_UCE_Attributes(Player player) { #if _MYSQL && _iMMOATTRIBUTES foreach (UCE_AttributeTemplate template in player.playerAttributes.UCE_AttributeTypes) { if (template == null) { continue; } UCE_Attribute attr = new UCE_Attribute(template); var table = ExecuteReaderMySql("SELECT points FROM UCE_attributes WHERE `character`=@character AND name=@name", new MySqlParameter("@character", player.name), new MySqlParameter("@name", attr.name)); if (table.Count == 1) { var row = table[0]; attr.points = (int)row[0]; } player.UCE_Attributes.Add(attr); } #elif _SQLITE && _iMMOATTRIBUTES foreach (UCE_AttributeTemplate template in player.playerAttributes.UCE_AttributeTypes) { if (template == null) { continue; } UCE_Attribute attr = new UCE_Attribute(template); var table = ExecuteReader("SELECT points FROM character_UCE_attributes WHERE character=@character AND name=@name", new SqliteParameter("@character", player.name), new SqliteParameter("@name", attr.name)); if (table.Count == 1) { var row = table[0]; attr.points = Convert.ToInt32((long)row[0]); } player.UCE_Attributes.Add(attr); } #endif }
private void CharacterLoad_UCE_Attributes(Player player) { #if _MYSQL && _iMMOATTRIBUTES && _SERVER foreach (UCE_AttributeTemplate template in player.playerAttributes.UCE_AttributeTypes) { if (template == null) { continue; } UCE_Attribute attr = new UCE_Attribute(template); var table = ExecuteReaderMySql("SELECT points FROM UCE_attributes WHERE `character`=@character AND name=@name", new MySqlParameter("@character", player.name), new MySqlParameter("@name", attr.name)); if (table.Count == 1) { var row = table[0]; attr.points = (int)row[0]; } player.UCE_Attributes.Add(attr); } #elif _SQLITE && _iMMOATTRIBUTES && _SERVER foreach (UCE_AttributeTemplate template in player.playerAttributes.UCE_AttributeTypes) { if (template == null) { continue; } UCE_Attribute attr = new UCE_Attribute(template); var table = connection.Query <UCE_attributes>("SELECT points FROM UCE_attributes WHERE character=? AND name=?", player.name, attr.name); if (table.Count == 1) { var row = table[0]; attr.points = row.points; } player.UCE_Attributes.Add(attr); } #endif }
// ----------------------------------------------------------------------------------- // setBonusAttributeIndividual // ----------------------------------------------------------------------------------- #if _iMMOATTRIBUTES public int setBonusAttributeIndividual(ItemSlot slot, SyncListItemSlot equipment, UCE_Attribute attribute) { int iPoints = 0; // -- Individual Bonus (Applied per Item) if (slot.amount > 0 && UCE_hasIndividualSetBonus() && UCE_validIndividualSetBonus(equipment)) { foreach (UCE_AttributeModifier modifier in ((EquipmentItem)data).individualStatModifiers.UCE_AttributeModifiers) { if (modifier.template == attribute.template) { iPoints += Convert.ToInt32(attribute.points * modifier.percentBonus); iPoints += modifier.flatBonus; } } } return(iPoints); }
private void OnServerCharacterCreate_UCE_Traits(CharacterCreateMsg netMsg, Player player) { if (netMsg == null || netMsg.traits == null || netMsg.traits.Length == 0) return; foreach (int traitId in netMsg.traits) { if (traitId != 0) { UCE_TraitTemplate trait; if (UCE_TraitTemplate.dict.TryGetValue(traitId, out trait)) { player.UCE_Traits.Add(new UCE_Trait(trait)); #if _iMMOATTRIBUTES foreach (UCE_AttributeTemplate template in player.playerAttributes.UCE_AttributeTypes) { if (template == null) continue; UCE_Attribute attr = new UCE_Attribute(template); player.playerAttributes.UCE_Attributes.Add(attr); } #endif // ---------------------------------------------------------------------- foreach (UCE_SkillRequirement startSkill in trait.startingSkills) { for (int i = 0; i < player.skills.skills.Count; ++i) { if (player.skills.skills[i].data == startSkill.skill) { Skill skill = player.skills.skills[i]; skill.level += startSkill.level; player.skills.skills[i] = skill; } } } // ---------------------------------------------------------------------- foreach (UCE_ItemModifier startItem in trait.startingItems) { player.inventory.Add(new Item(startItem.item), startItem.amount); } #if _iMMOPRESTIGECLASSES if (trait.startingPrestigeClass != null) player.UCE_prestigeClass = trait.startingPrestigeClass; #endif #if _iMMOHONORSHOP foreach (UCE_HonorShopCurrencyCost currency in trait.startingHonorCurrency) player.UCE_AddHonorCurrency(currency.honorCurrency, currency.amount); #endif #if _iMMOFACTIONS foreach (UCE_FactionRating faction in trait.startingFactions) player.UCE_AddFactionRating(faction.faction, faction.startRating); #endif #if _iMMOCRAFTING foreach (UCE_CraftingProfessionRequirement prof in trait.startingCraftingProfession) { if (player.UCE_HasCraftingProfession(prof.template)) { var tmpProf = player.UCE_getCraftingProfession(prof.template); tmpProf.experience += prof.level; player.UCE_setCraftingProfession(tmpProf); } else { UCE_CraftingProfession tmpProf = new UCE_CraftingProfession(prof.template.name); tmpProf.experience += prof.level; player.UCE_Crafts.Add(tmpProf); } } #endif #if _iMMOHARVESTING foreach (UCE_HarvestingProfessionRequirement prof in trait.startingHarvestingProfession) { if (player.HasHarvestingProfession(prof.template)) { var tmpProf = player.getHarvestingProfession(prof.template); tmpProf.experience += prof.level; player.SetHarvestingProfession(tmpProf); } else { UCE_HarvestingProfession tmpProf = new UCE_HarvestingProfession(prof.template.name); tmpProf.experience += prof.level; player.UCE_Professions.Add(tmpProf); } } #endif #if _iMMOPVP player.UCE_setRealm(trait.changeRealm, trait.changeAlliedRealm); #endif // ------------ Recalculate all Maxes here again (in case of bonusses) player.health.current = player.health.max; player.mana.current = player.mana.max; #if _iMMOSTAMINA player.stamina = player.staminaMax; #endif // ---------------------------------------------------------------------- } } } }