Ejemplo n.º 1
0
 public void InitializeTalentSpells(WS_PlayerData.CharacterObject objCharacter)
 {
     WS_Spells.SpellTargets t             = new WS_Spells.SpellTargets();
     WS_Base.BaseUnit       objCharacter2 = objCharacter;
     t.SetTarget_SELF(ref objCharacter2);
     objCharacter = (WS_PlayerData.CharacterObject)objCharacter2;
     foreach (KeyValuePair <int, WS_Spells.CharacterSpell> Spell in objCharacter.Spells)
     {
         if (WorldServiceLocator._WS_Spells.SPELLs.ContainsKey(Spell.Key) && WorldServiceLocator._WS_Spells.SPELLs[Spell.Key].IsPassive)
         {
             if (!objCharacter.HavePassiveAura(Spell.Key) && WorldServiceLocator._WS_Spells.SPELLs[Spell.Key].CanCast(ref objCharacter, t, FirstCheck: false) == SpellFailedReason.SPELL_NO_ERROR)
             {
                 WS_Spells.SpellInfo spellInfo = WorldServiceLocator._WS_Spells.SPELLs[Spell.Key];
                 WS_Base.BaseObject  caster    = objCharacter;
                 spellInfo.Apply(ref caster, t);
                 objCharacter = (WS_PlayerData.CharacterObject)caster;
             }
             else if (objCharacter.HavePassiveAura(Spell.Key) && WorldServiceLocator._WS_Spells.SPELLs[Spell.Key].CanCast(ref objCharacter, t, FirstCheck: false) != SpellFailedReason.SPELL_NO_ERROR)
             {
                 objCharacter.RemoveAuraBySpell(Spell.Key);
             }
         }
     }
 }
Ejemplo n.º 2
0
 public InventoryChangeFailure CanUseAmmo(ref WS_PlayerData.CharacterObject objCharacter, int AmmoID)
 {
     if (objCharacter.DEAD)
     {
         return(InventoryChangeFailure.EQUIP_ERR_YOU_ARE_DEAD);
     }
     if (!WorldServiceLocator._WorldServer.ITEMDatabase.ContainsKey(AmmoID))
     {
         return(InventoryChangeFailure.EQUIP_ERR_ITEM_NOT_FOUND);
     }
     if (WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].InventoryType != INVENTORY_TYPES.INVTYPE_AMMO)
     {
         return(InventoryChangeFailure.EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE);
     }
     if (WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].AvailableClasses != 0L && (ulong)(WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].AvailableClasses & objCharacter.ClassMask) == 0)
     {
         return(InventoryChangeFailure.EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM);
     }
     if (WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].AvailableRaces != 0L && (ulong)(WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].AvailableRaces & objCharacter.RaceMask) == 0)
     {
         return(InventoryChangeFailure.EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM);
     }
     if (WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].ReqSkill != 0)
     {
         if (!objCharacter.HaveSkill(WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].ReqSkill))
         {
             return(InventoryChangeFailure.EQUIP_ERR_NO_REQUIRED_PROFICIENCY);
         }
         if (!objCharacter.HaveSkill(WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].ReqSkill, WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].ReqSkillRank))
         {
             return(InventoryChangeFailure.EQUIP_ERR_SKILL_ISNT_HIGH_ENOUGH);
         }
     }
     if (WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].ReqSpell != 0 && !objCharacter.HaveSpell(WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].ReqSpell))
     {
         return(InventoryChangeFailure.EQUIP_ERR_NO_REQUIRED_PROFICIENCY);
     }
     if (WorldServiceLocator._WorldServer.ITEMDatabase[AmmoID].ReqLevel > objCharacter.Level)
     {
         return(InventoryChangeFailure.EQUIP_ERR_YOU_MUST_REACH_LEVEL_N);
     }
     if (objCharacter.HavePassiveAura(46699))
     {
         return(InventoryChangeFailure.EQUIP_ERR_BAG_FULL6);
     }
     return(InventoryChangeFailure.EQUIP_ERR_OK);
 }