Ejemplo n.º 1
0
    public void AppFuse(EntityParent caster, int skillID, bool isCommunicateMix)
    {
        if (caster == null)
        {
            return;
        }
        if (caster.BattleBaseAttrs == null)
        {
            return;
        }
        XDict <int, LocalDimensionPetSpirit> petSpiritByOwnerID = LocalAgent.GetPetSpiritByOwnerID(caster.ID);

        if (petSpiritByOwnerID == null)
        {
            return;
        }
        if (petSpiritByOwnerID.Count == 0)
        {
            return;
        }
        int num = -1;

        for (int i = 0; i < petSpiritByOwnerID.Count; i++)
        {
            if (petSpiritByOwnerID.ElementValueAt(i).fuseRitualSkillInfo != null)
            {
                if (petSpiritByOwnerID.ElementValueAt(i).fuseRitualSkillInfo.skillId == skillID)
                {
                    num = petSpiritByOwnerID.ElementKeyAt(i);
                    LocalAgent.RemovePetSummonRitualSkill(caster.ID, petSpiritByOwnerID.ElementValueAt(i));
                    break;
                }
            }
        }
        List <EntityParent> values    = EntityWorld.Instance.GetEntities <EntityPet>().Values;
        EntityPet           entityPet = null;

        for (int j = 0; j < values.get_Count(); j++)
        {
            if (values.get_Item(j).IsFighting&& values.get_Item(j).OwnerListIdx == num && values.get_Item(j).OwnerID == caster.ID)
            {
                entityPet = (values.get_Item(j) as EntityPet);
                break;
            }
        }
        if (entityPet == null)
        {
            return;
        }
        FuseState fuseState = new FuseState();

        fuseState.modelID = caster.ModelID;
        fuseState.skill.Clear();
        using (Dictionary <int, int> .Enumerator enumerator = caster.GetSkillPairPart().GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                KeyValuePair <int, int> current = enumerator.get_Current();
                fuseState.skill.Add(current.get_Key(), current.get_Value());
            }
        }
        using (List <int> .Enumerator enumerator2 = caster.GetSkillSinglePart().GetEnumerator())
        {
            while (enumerator2.MoveNext())
            {
                int current2 = enumerator2.get_Current();
                fuseState.skill.AddValue(current2);
            }
        }
        fuseState.petID = entityPet.ID;
        LocalAgent.AppClearBuff(caster.ID);
        LocalAgent.AppClearBuff(entityPet.ID);
        this.SetFuseAttrs(caster, entityPet, fuseState);
        Pet pet = DataReader <Pet> .Get(entityPet.TypeID);

        for (int k = 0; k < pet.fuseSkill.get_Count(); k++)
        {
            if (pet.fuseSkill.get_Item(k).key == caster.TypeID)
            {
                List <KeyValuePair <int, int> > list = new List <KeyValuePair <int, int> >();
                list.Add(new KeyValuePair <int, int>(1, pet.fuseNormalSkill));
                list.Add(new KeyValuePair <int, int>(11, pet.fuseSkill.get_Item(k).value));
                LocalBattleProtocolSimulator.SendFit(caster.ID, entityPet.ID, pet.fuseModle, list, 1000 * (int)(entityPet.FuseTime + (caster as EntitySelf).TotalFuseTimePlus));
                caster.SetValue(GameData.AttrType.MoveSpeed, DataReader <AvatarModel> .Get(pet.fuseModle).speed, true);
                break;
            }
        }
        fuseState.timerID = TimerHeap.AddTimer((uint)(1000f * (entityPet.FuseTime + (caster as EntitySelf).TotalFuseTimePlus)), 0, delegate
        {
            this.AppDeFuse(caster.ID);
        });
        this.fuseStateTable.Add(caster.ID, fuseState);
    }