void setInfoPetData(PetData data)
    {
        infoPart.gameObject.SetActive(true);

        if (data.currentState == GameController.Pet_Default)
        {
            infoPart.Find("ConfirmButton").Find("Text").GetComponent <Text> ().text = LanController.getString("toFight");
        }
        else
        {
            infoPart.Find("ConfirmButton").Find("Text").GetComponent <Text> ().text = LanController.getString("toRest");
        }

        curIndex = list.IndexOf(data);
        if (list.Count <= 1)
        {
            LeftBut.SetActive(false);
            RightBut.SetActive(false);
        }
        else
        {
            LeftBut.SetActive(true);
            RightBut.SetActive(true);
        }


        curPetData = data;
        fishBut.GetComponent <FishInfoTip> ().init(data);
    }
示例#2
0
    public Pet ReturnPet(PetData pet)
    {
        Pet p = new Pet();

        p.id             = pet.id;
        p.namePet        = pet.namePet;
        p.gender         = pet.gender;
        p.hunger         = pet.hunger;
        p.happiness      = pet.happiness;
        p.emotion        = pet.emotion;
        p.UUID           = pet.UUID;
        p.selected       = pet.selected;
        p.status         = pet.status;
        p.lastTimeReward = pet.lastTimeReward;

        p.color   = pet.color;
        p.head    = pet.head;
        p.ear     = pet.ear;
        p.eye     = pet.eye;
        p.eyebrow = pet.eyebrow;
        p.nose    = pet.nose;
        p.mouth   = pet.mouth;
        p.pattern = pet.pattern;

        p.shirtWearing       = pet.shirtWearing;
        p.pantWearing        = pet.pantWearing;
        p.shoeWearing        = pet.shoeWearing;
        p.accessoriesWearing = pet.accessoriesWearing;

        return(p);
    }
示例#3
0
    public override void InitData()
    {
        ClearAssistance();
        ClearBasicData();

        mapData.InitData();

        Assistance.EnableAllAssistances();

        activeGameGuideTutorial  = !TutorialManager.GetInstance().IsCleared(Define.TutorialType.GameGuide);
        activeSkillGuideTutorial = !TutorialManager.GetInstance().IsCleared(Define.TutorialType.SkillGuide);

        mapAssistance.SetGameGuideTutorial(activeGameGuideTutorial);

        SetCombo(0);
        nowKeepComboCount = 0;
        keepComboCount    = 0;
        for (int i = 0; i < Define.selectedPetsCount; i++)
        {
            PetData pet = DataManager.GetInstance().GetSelectedPetData(i);
            if (pet != null && pet.passiveSkillType == Define.SkillType.KeepCombo)
            {
                int count = pet.GetPassiveSkill().GetSkillValue(pet.pSkillLv);
                if (keepComboCount < count)
                {
                    keepComboCount = count;
                }
            }
        }
    }
示例#4
0
    public GameObject AddPet(PetData pd, GameObject go)
    {
        PlayerInfo pi     = go.GetComponent <PlayerInfo>();
        Player     player = pi.Player;
        GameObject pet    = Object.Instantiate(pd.RolePrefab, go.transform.position, Quaternion.identity);

        int instanceId = IdCount;

        SetRoleList(instanceId, pet);
        InitPlayerInfo(pd, pet, player, instanceId);
        SetCurrentRole(pet);

        if (player.CampType == LocalPlayer.CampType)
        {
            pet.AddComponent <VisualProvider>();
        }
        else
        {
            pet.AddComponent <VisualTest>();
        }
        if (player.IsLocal)
        {
            pet.AddComponent <PlayerMove>().SetPlayerMng(this);
        }
        return(pet);
    }
    public override void InitItem(int idx)
    {
        petData = null;
        DataManager.GetInstance().TryGetPlaymatePetData(ref petData, idx);

        UpdateUI();
    }
    public static void addPet(PetData data)
    {
        List <PetData> pets = getPets();

        pets.Add(data);
        PlayerPrefs.SetString("Pets", JsonMapper.ToJson(pets));
    }
示例#7
0
 /// <summary>
 /// 服务端数据构造
 /// </summary>
 public MercenaryInfo(NewPetRef _refData)
 {
     refData    = _refData;
     serverData = new PetData();
     serverData.serverInstanceID = _refData.type;
     SetTitle();
 }
示例#8
0
    public override void Enable()
    {
        bActingSkill = false;
        bonusExp     = 1;
        for (int i = 0; i < Define.selectedPetsCount; i++)
        {
            gotExpInGame[i] = 0;

            PetData pet = DataManager.GetInstance().GetSelectedPetData(i);
            if (pet != null)
            {
                skillData[i].isNull           = false;
                skillData[i].petIdx           = pet.unqIdx;
                skillData[i].maxSkillCooltime = pet.GetMaxSkillCoolTime();
                skillData[i].nowCooltime      = 0;
                skillData[i].useSkillCount    = 0;
            }
            else
            {
                skillData[i].isNull = true;
            }
        }
        UpdateSkillCooltime();

        DataManager.GetInstance().ClearUseSkillData();
    }
示例#9
0
    public void OnClickAnimalItem(PetData data)
    {
        SoundManager.GetInstance().PlaySound(Define.SoundType.Click);

        if (data == null)
        {
            //선택 해제. //
            DataManager.GetInstance().SetSelectedPetData(null, selectedIdx);

            UpdatePetsData();
            HideList();
        }
        else
        {
            if (selectedIdx != Define.nullValue)
            {
                //이미 선택된 동물이 아닌 경우에만 교체. //
                int idx = 0;
                if (!DataManager.GetInstance().IsSelectedAnimal(ref idx, data.unqIdx))
                {
                    DataManager.GetInstance().SetSelectedPetData(data, selectedIdx);

                    UpdatePetsData();
                    HideList();

                    if (LobbyManager.activeAdoptGuideTutorial)
                    {
                        TutorialManager.GetInstance().CallReaction();
                    }
                }
            }
        }

        DataManager.GetInstance().SaveAllData();
    }
示例#10
0
    public void EditPetWebRequest(string idPet, UnityAction callback)
    {
        Popup.Ins.PopupWaiting(true);
        HttpClient client = new HttpClient();

        client.Headers.Add("Authorization", "Token " + PlayerPrefs.GetString("token"));
        Dictionary <string, string> keyValuePairs = new Dictionary <string, string>();

        keyValuePairs.Add("name", namePetEdit);
        keyValuePairs.Add("pettype", typeEdit);
        keyValuePairs.Add("breed", breedEdit);
        keyValuePairs.Add("gendaer", genderEdit);
        keyValuePairs.Add("birthdate", birthdayEdit);
        keyValuePairs.Add("weight", weightEdit);
        keyValuePairs.Add("furcolor", colorEdit);

        IHttpContent content = new FormUrlEncodedContent(keyValuePairs);

        client.Patch(new Uri("https://www.pacheti.com/api/pets/" + idPet + "/edit/"), content, HttpCompletionOption.AllResponseContent, r =>
        {
            Popup.Ins.PopupWaiting(false);
            if (!r.IsSuccessStatusCode)
            {
                Debug.Log(r.ReadAsString());
            }
            else
            {
                Debug.Log(r.ReadAsString());
                PetData petData = SaveSystem.A_LoadPet(int.Parse(idPet));
                petData.namePet = namePetEdit;
                API_Game.Ins.PutPetRequest(petData, callback);
                // callback();
            }
        });
    }
示例#11
0
    void creatFishCannon(PetData data)
    {
        GameObject fishCannon = (GameObject)Instantiate(GameController.GetInstance().getPrefab("FishCannon"), new Vector3((float)data.posx, (float)data.posy, GameController.fishCannon_z), Quaternion.identity, cannonCanvas.transform);

        fishCannon.GetComponent <FishCannon> ().init(data);
        fishCannonList.Add(fishCannon);
    }
示例#12
0
    protected static void ReadPets()
    {
        Pets = IterateAllToDict(pFile.BaseNode["Item"]["Pet"], pNode =>
        {
            int ID = (int)Utils.ConvertNameToID(pNode.Name);
            var pd = new PetData
            {
                ID        = ID,
                Reactions = new Dictionary <byte, PetReactionData>()
            };

            foreach (var mNode in pNode["interact"])
            {
                var prd = new PetReactionData
                {
                    ReactionID = byte.Parse(mNode.Name),
                    Inc        = mNode["inc"].ValueByte(),
                    Prob       = mNode["prob"].ValueByte(),
                    LevelMin   = mNode["l0"].ValueByte(),
                    LevelMax   = mNode["l1"].ValueByte()
                };
                pd.Reactions.Add(prd.ReactionID, prd);
            }

            foreach (var node in pNode["info"])
            {
                switch (node.Name)
                {
                case "icon":
                case "iconD":
                case "iconRaw":
                case "iconRawD":
                case "cash":
                    break;

                case "hungry":
                    pd.Hungry = node.ValueByte();
                    break;

                case "life":
                    pd.Life = node.ValueByte();
                    break;

                default:
                    Console.WriteLine($"Unhandled Pet node {node.Name} for id {ID}");
                    break;
                }
            }
            return(pd);
        }, x => x.ID);

        foreach (var node in pFile.BaseNode["String"]["Item.img"]["Pet"])
        {
            var itemId = int.Parse(node.Name);
            if (!Pets.ContainsKey(itemId))
            {
                Pets[itemId].Name = node["name"].ValueString();
            }
        }
    }
示例#13
0
 public override void Enable()
 {
     bCheckingTime = false;
     bPause        = false;
     warningMode   = false;
     freezingTime  = 0f;
     remainTime    = DataManager.GetDesignValue(Define.GameDesign.BasicGameTime);
     for (int i = 0; i < Define.selectedPetsCount; i++)
     {
         PetData pet = DataManager.GetInstance().GetSelectedPetData(i);
         if (pet != null && pet.passiveSkillType == Define.SkillType.AddTime)
         {
             remainTime += DataManager.GetInstance().GetSkillTable(pet.passiveSkillType).GetSkillValue(pet.pSkillLv);
         }
     }
     maxRemainTime = remainTime;
     if (gameTimeUpdateCallback != null)
     {
         gameTimeUpdateCallback(remainTime);
     }
     if (warningUICallback != null)
     {
         warningUICallback(warningMode);
     }
 }
示例#14
0
    public PetData GetFeelineGenes(string genesStrain)
    {
        if (int.Parse(genesStrain) <= 1)
        {
            return(GetEmptyFeelineGenes());
        }

        var petData = new PetData();

        petData.eyes      = GetGene(genesStrain, 2);
        petData.face      = GetGene(genesStrain, 4);
        petData.ears      = GetGene(genesStrain, 6);
        petData.belly     = GetGene(genesStrain, 8);
        petData.back      = GetGene(genesStrain, 10);
        petData.neck      = GetGene(genesStrain, 12);
        petData.tail      = GetGene(genesStrain, 14);
        petData.legsFront = GetGene(genesStrain, 16);
        petData.legsBack  = GetGene(genesStrain, 18);

        var magicColorGene = GetGene(genesStrain, 20);

        petData.magicColor = GetMagicColor(magicColorGene);

        var skinColorGene = GetGene(genesStrain, 22);

        petData.skinColor = GetSkinColor(skinColorGene);

        var spotsColorGene = GetGene(genesStrain, 24);

        petData.spotsColor = GetSpotsColor(spotsColorGene);

        return(petData);
    }
示例#15
0
    public void Create( )
    {
        //if (namePet.text.Length <= 0)
        //{
        //    Popup.Ins.PopupOne("Please name the pet.", "OK", null);
        //    return;
        //}

        //if ((!btnMale.interactable && !btnFemale.interactable) || (btnMale.interactable && btnFemale.interactable))
        //{
        //    Popup.Ins.PopupOne("Please select gender","OK",null);
        //    return;
        //}

        Popup.Ins.PopupWaiting(true);
        PetData pet = SaveSystem.A_LoadPet(PlayerPrefs.GetInt("idPet"));

        Debug.LogError(PlayerPrefs.GetInt("idPet"));
        pet.color   = numColor;
        pet.head    = numHead;
        pet.ear     = numEar;
        pet.pattern = numPattern;
        pet.eye     = numEye;
        pet.eyebrow = numEyebrow;
        pet.nose    = numNose;
        pet.mouth   = numMouth;

        //SaveSystem.A_EditPet(pet);
        API_Game.Ins.PutPetRequest(pet, FinishCrreate);
        Debug.Log("Create Saved");

        //PlayerPrefs.SetString("LoadScene", "Edit");
    }
示例#16
0
    public void InitializePet(PetData petData, Texture2D petPhoto)
    {
        _id           = petData.PetID;
        _name         = petData.PetName;
        _color        = petData.Color;
        _size         = petData.Size;
        _breed        = petData.PrimaryBreed;
        _age          = petData.Age;
        _description  = petData.Description;
        _photo        = petPhoto;
        _agent        = GetComponent <NavMeshAgent>();
        _controller   = GetComponent <StateController>();
        _soundEmitter = GetComponent <PetSoundEmitter>();

        Material petMaterial = new Material(DefaultMaterial.shader)
        {
            color = GetPetColor()
        };

        Material[] mats = MeshRenderer.materials;
        mats[0] = petMaterial;
        MeshRenderer.materials = mats;
        transform.localScale   = GetPetSize();
        _agent.speed           = transform.localScale.x;
    }
示例#17
0
    // Token: 0x06001729 RID: 5929 RVA: 0x0027DDF8 File Offset: 0x0027BFF8
    private byte GetPetState(byte lockStone)
    {
        PetData petData     = this.PM.GetPetData((int)this.PM.sortPetData[this.sortIndex]);
        PetTbl  recordByKey = this.PM.PetTable.GetRecordByKey(this.ID);
        bool    flag        = petData.Level == petData.GetMaxLevel(false);
        bool    flag2;

        if (petData.Enhance == 2 || petData.CheckState(PetManager.EPetState.Evolution))
        {
            flag2 = (flag = false);
        }
        else
        {
            flag2 = (DataManager.Instance.GetCurItemQuantity(this.PetStoneID, 0) >= this.PM.GetEvoNeed_Stone(petData.Enhance, recordByKey.Rare));
        }
        if (flag && flag2)
        {
            return(1);
        }
        if (!flag && flag2)
        {
            return(2);
        }
        if (lockStone == 0)
        {
            DataManager instance        = DataManager.Instance;
            ushort      propertiesValue = instance.EquipTable.GetRecordByKey(instance.EquipTable.GetRecordByKey(this.PetStoneID).SyntheticParts[1].SyntheticItem).PropertiesInfo[0].PropertiesValue;
            int         num             = 3;
            if (petData.Enhance == 0)
            {
                num = 1;
            }
            else if (petData.Enhance == 1)
            {
                num = 2;
            }
            for (int i = 0; i < num; i++)
            {
                if (propertiesValue == 0)
                {
                    break;
                }
                if (recordByKey.PetSkill[i] != 0 && petData.SkillLv[i] != 0)
                {
                    PetSkillTbl recordByKey2 = this.PM.PetSkillTable.GetRecordByKey(recordByKey.PetSkill[i]);
                    if (recordByKey2.UpLevel != petData.SkillLv[i])
                    {
                        if ((int)petData.SkillLv[i] > recordByKey2.OpenLevel.Length || recordByKey2.OpenLevel[(int)(petData.SkillLv[i] - 1)] <= petData.Level || petData.SkillExp[i] != this.GetNeedSkillExp(recordByKey2.Experience, petData.SkillLv[i]) - 1u)
                        {
                            if (instance.GetCurItemQuantity(this.PetStoneID, 0) >= this.PM.PetUI_UpNeedStoneCount)
                            {
                                return(3);
                            }
                        }
                    }
                }
            }
        }
        return(0);
    }
示例#18
0
    // Token: 0x06001728 RID: 5928 RVA: 0x0027DD18 File Offset: 0x0027BF18
    public void UpdateState(byte lockStone)
    {
        if (!this.gameobject.activeSelf || this.cellType != _PetItem._ItemType.Pet)
        {
            return;
        }
        if (this.sortIndex >= this.PM.sortPetData.Count)
        {
            this.gameobject.SetActive(false);
            return;
        }
        PetData petData = this.PM.GetPetData((int)this.PM.sortPetData[this.sortIndex]);

        Array.Clear(this.PetNoticeShow, 0, this.PetNoticeShow.Length);
        byte petState = this.GetPetState(lockStone);

        if (petState > 0 && petState <= 3)
        {
            this.PetNoticeShow[(int)(petState - 1)] = true;
        }
        this.PetNoticeShow[3] = petData.CheckState(PetManager.EPetState.Training);
        for (int i = 0; i < 4; i++)
        {
            this.PetNotice[i].SetActive(this.PetNoticeShow[i]);
        }
    }
示例#19
0
 public void SetSelectedPetData(PetData data, int idx)
 {
     if (Define.selectedPetsCount > idx)
     {
         selectedPetArray[idx] = data;
     }
 }
示例#20
0
    private List <GameObject> GenerateRandomPets()
    {
        string[]      petNames = PetData.PetNames;
        List <string> petPool  = new List <string>();

        int levelBasedIndex = saveManager.activeSave.highestLevel - 3;

        while (petPool.Count != 3)
        {
            int    randomIndex = Random.Range(levelBasedIndex, levelBasedIndex + 5);
            string randomPetName;

            if (randomIndex <= petNames.Length)
            {
                randomPetName = petNames[randomIndex];

                if (!saveManager.activeSave.unlockedPets.Contains(randomPetName) && !petPool.Contains(randomPetName))
                {
                    petPool.Add(randomPetName);
                }
            }
        }

        List <GameObject> randomPets = new List <GameObject>();

        foreach (string petName in petPool)
        {
            randomPets.Add(PetData.GetPetData(petName));
        }

        return(randomPets);
    }
示例#21
0
 public PetDataEx(PetData data, PetInfo info)
 {
     this.Data = data;
     this.Info = info;
     this.Relation = 0;
     this.socketSlot = -1;
 }
示例#22
0
    /// <summary>
    /// 服务端数据构造
    /// </summary>
    public MercenaryInfo(pet_base_info _data, PlayerBaseInfo _info)
    {
        PetData data = new PetData(_data);

        serverData = data;
        ownerInfo  = _info;
        SetTitle();
    }
示例#23
0
 private void SpawnPets()
 {
     foreach (string petName in saveManager.activeSave.currentPets)
     {
         GameObject petGameObject = PetData.GetPetData(petName);
         Instantiate(petGameObject, Utility.GenerateRandomVector3(), petGameObject.transform.rotation, transform);
     }
 }
示例#24
0
    public void creatNewPet(PetData data)
    {
        GameObject pFish = (GameObject)Instantiate(GameController.GetInstance().getPrefab(data.fishName), Vector3.zero, Quaternion.identity);

        pFish.AddComponent <Pet> ().init(data);
        pFish.name = data.data_id.ToString();
        petList.Add(pFish);
    }
示例#25
0
 public void init(PetData data)
 {
     _petData        = data;
     gameObject.name = "FishCannon";
     transform.Find("Fish").GetComponent <Animator> ().Play(data.fishName);
     transform.Find("Fish").transform.localScale = new Vector3(data.getCannonScale(), data.getCannonScale(), 1);
     setDefault();
 }
示例#26
0
 void OnClickPetShow(uint iid)
 {
     _curPetIid  = iid;
     _curPetData = PetModel.getInstance().GetPetDataByIid(iid);
     RefreshPetListCon();
     RefreshPetTrainCon();
     RefreshPetUpgrade();
 }
        public override void OnMissileHit(BaseEntity2D sender, MissileData missile, Vector2 point)
        {
            if (sender != null && machine.currentState.GetName() != StateTypes.Dead.ToString())
            {
                PetData pet = sender.data as PetData;

                data.attributeBox.Validate(ValidateType.Injured, pet.attributeBox, missile, point);
            }
        }
示例#28
0
 public void init(PetData data)
 {
     petData    = data;
     speed      = petData.getCurSpeed();
     WorldRange = GameController.WorldBound;
     getNewForce();
     attackCount = petData.getCurASpeed();
     petskin     = (GameObject)Instantiate(GameController.GetInstance().getPrefab("PetSkin"), new Vector3(0, 0, 0), Quaternion.identity, transform);
 }
示例#29
0
    public void UseSkill(int idx)
    {
        PetData    data  = DataManager.GetInstance().GetSelectedPetData(idx);
        SkillTable skill = DataManager.GetInstance().GetSkillTable(data.activeSkillType);

        bActingSkill = true;

        UseSkillPopup popup = PopupSystem.GetPopup <UseSkillPopup>(Define.PopupType.UseSkill);

        popup.SetData(data, () =>
        {
            skillData[idx].nowCooltime = 0;
            skillData[idx].useSkillCount++;
            scoreAssistance.SetSkillPointMode();

            nowUseSkill = skill.skillType;

            switch (skill.skillType)
            {
            case Define.SkillType.StopTime:
                gameTimeAssistance.FreezeTime(skill.GetSkillValue(data.aSkillLv));
                AfterUseSkill();
                break;

            case Define.SkillType.BrokenTiles:
                mapAssistance.AllBlocksDown(AfterUseSkill);
                break;

            case Define.SkillType.ClearAllTiles:
                mapAssistance.ClearAllBlocks(AfterUseSkill);
                break;

            case Define.SkillType.DoubleScore:
                scoreAssistance.SetMultiBonus(
                    DataManager.GetDesignValue(Define.GameDesign.DoubleSkillScoreBonus),
                    skill.GetSkillValue(data.aSkillLv)
                    );
                AfterUseSkill();
                break;

            case Define.SkillType.FillLines:
                mapAssistance.ChangeTileTypeToFillLines(idx, AfterUseSkill);
                break;

            case Define.SkillType.ChangePuzzles:
                mapAssistance.ChangeAllPuzzles(AfterUseSkill);
                break;

            default:
                Debug.Log("something is wrong");
                AfterUseSkill();
                break;
            }
        });
        PopupSystem.OpenPopup(Define.PopupType.UseSkill);
    }
示例#30
0
    public void OpenEdit(GameObject obj)
    {
        PetData petData = obj.GetComponent <PetData>();

        petID = petData.id;
        popupEdit.SetActive(true);
        editBtn.onClick.AddListener(EditPet);
        editAvatarBtn.onClick.AddListener(EditAvatar);
        cancelBtn.onClick.AddListener(Cancel);
    }
示例#31
0
    private PetData GetEmptyFeelineGenes()
    {
        var petData = new PetData();

        petData.magicColor = -1;
        petData.spotsColor = -1;
        // All other params are equal to 0 by default

        return(petData);
    }
示例#32
0
文件: GS.cs 项目: dautai/petfighting
    public static void GetPetData()
    {
        string str;
        string[] strs;
        Service1 ser = new Service1();
        str = ser.GetListPet(playerID);
        strs = str.Split(':');

        //set pet data
        petDatas = new System.Collections.Generic.List<PetData>();
        for(int i = 0; i < strs.Length; ++i)
        {
            if(strs[i] == "")
                continue;
            PetData tPet = new PetData();
            tPet.SetData(strs[i]);

            petDatas.Add(tPet);
        }

        numberOfPet = GS.petDatas.Count;
    }
示例#33
0
 public void LoadData(uint version, List<PetData> data)
 {
     if (version == 0u || version == this.Version)
     {
         return;
     }
     this.Version = version;
     this.pets.Clear();
     for (int i = 0; i < data.Count; i++)
     {
         this.AddPet(data[i]);
     }
     PetData petData = new PetData();
     if (petData != null)
     {
         ObscuredStats data2 = Globals.Instance.Player.Data;
         petData.ID = 100uL;
         petData.InfoID = 90000;
         petData.Level = data2.Level;
         petData.Further = (uint)data2.FurtherLevel;
         petData.Awake = (uint)data2.AwakeLevel;
         petData.ItemFlag = (uint)data2.AwakeItemFlag;
         petData.CultivateCount = data2.CultivateCount;
         petData.Attack = data2.Attack;
         petData.PhysicDefense = data2.PhysicDefense;
         petData.MagicDefense = data2.MagicDefense;
         petData.MaxHP = data2.MaxHP;
         petData.AttackPreview = data2.AttackPreview;
         petData.PhysicDefensePreview = data2.PhysicDefensePreview;
         petData.MagicDefensePreview = data2.MagicDefensePreview;
         petData.MaxHPPreview = data2.MaxHPPreview;
         PlayerPetInfo.Info.Name = data2.Name;
         PlayerPetInfo.Info.Quality = Globals.Instance.Player.GetQuality();
         this.AddPet(petData);
     }
 }
示例#34
0
 private void AddPet(PetData data)
 {
     PetInfo info = Globals.Instance.AttDB.PetDict.GetInfo(data.InfoID);
     if (info == null)
     {
         Debug.LogError(new object[]
         {
             string.Format("PetDict.GetInfo error, id = {0}", data.InfoID)
         });
         return;
     }
     PetDataEx petDataEx = new PetDataEx(data, info);
     this.pets.Add(petDataEx.Data.ID, petDataEx);
 }
示例#35
0
 public static void GetAttribute(PetInfo petInfo, PetData petData, ref int maxHP, ref int attack, ref int physicDefense, ref int magicDefense)
 {
     if (petInfo == null)
     {
         global::Debug.LogError(new object[]
         {
             "petInfo == null"
         });
         return;
     }
     long num = 0L;
     long num2 = 0L;
     long num3 = 0L;
     long num4 = 0L;
     long num5 = 0L;
     long num6 = 0L;
     long num7 = 0L;
     long num8 = 0L;
     int elementType = petInfo.ElementType;
     if (petData.Further > 0u)
     {
         TinyLevelInfo info = Globals.Instance.AttDB.TinyLevelDict.GetInfo((int)petData.Further);
         if (info == null)
         {
             global::Debug.LogError(new object[]
             {
                 string.Format("TinyLevelDict.GetInfo error, id = {0}", petData.Further)
             });
             return;
         }
         if (petInfo.Quality >= 0 && petInfo.Quality < info.PetMaxHPFurther.Count)
         {
             num = (long)info.PetMaxHPFurther[petInfo.Quality];
         }
         if (petInfo.Quality >= 0 && petInfo.Quality < info.PetAttackFurther.Count)
         {
             num2 = (long)info.PetAttackFurther[petInfo.Quality];
         }
         if (petInfo.Quality >= 0 && petInfo.Quality < info.PetPhysicDefenseFurther.Count)
         {
             num3 = (long)info.PetPhysicDefenseFurther[petInfo.Quality];
         }
         if (petInfo.Quality >= 0 && petInfo.Quality < info.PetMagicDefenseFurther.Count)
         {
             num4 = (long)info.PetMagicDefenseFurther[petInfo.Quality];
         }
         num = (long)petInfo.MaxHP + ((long)petInfo.MaxHPInc + num) * (long)petData.Level;
         num2 = (long)petInfo.Attack + ((long)petInfo.AttackInc + num2) * (long)petData.Level;
         num3 = (long)petInfo.PhysicDefense + ((long)petInfo.PhysicDefenseInc + num3) * (long)petData.Level;
         num4 = (long)petInfo.MagicDefense + ((long)petInfo.MagicDefenseInc + num4) * (long)petData.Level;
         int num9 = 0;
         while (num9 < petInfo.TalentID.Count && num9 < (int)petData.Further)
         {
             if (petInfo.TalentID[num9] != 0)
             {
                 TalentInfo info2 = Globals.Instance.AttDB.TalentDict.GetInfo(petInfo.TalentID[num9]);
                 if (info2 == null)
                 {
                     global::Debug.LogError(new object[]
                     {
                         string.Format("TalentDict.GetInfo error, id = {0}", petInfo.TalentID[num9])
                     });
                     return;
                 }
                 if (info2.TargetType != 2 || elementType == info2.TargetValue)
                 {
                     if (info2.EffectType == 1)
                     {
                         int value = info2.Value1;
                         switch (value)
                         {
                         case 1:
                             num += (long)info2.Value2;
                             break;
                         case 2:
                             num2 += (long)info2.Value2;
                             break;
                         case 3:
                             num3 += (long)info2.Value2;
                             break;
                         case 4:
                             num4 += (long)info2.Value2;
                             break;
                         default:
                             if (value == 20)
                             {
                                 num3 += (long)info2.Value2;
                                 num4 += (long)info2.Value2;
                             }
                             break;
                         }
                     }
                     else if (info2.EffectType == 2)
                     {
                         int value = info2.Value1;
                         switch (value)
                         {
                         case 1:
                             num5 += (long)info2.Value2;
                             break;
                         case 2:
                             num6 += (long)info2.Value2;
                             break;
                         case 3:
                             num7 += (long)info2.Value2;
                             break;
                         case 4:
                             num8 += (long)info2.Value2;
                             break;
                         default:
                             if (value == 20)
                             {
                                 num7 += (long)info2.Value2;
                                 num8 += (long)info2.Value2;
                             }
                             break;
                         }
                     }
                 }
             }
             num9++;
         }
     }
     else
     {
         num = (long)(petInfo.MaxHP + petInfo.MaxHPInc * (int)petData.Level);
         num2 = (long)(petInfo.Attack + petInfo.AttackInc * (int)petData.Level);
         num3 = (long)(petInfo.PhysicDefense + petInfo.PhysicDefenseInc * (int)petData.Level);
         num4 = (long)(petInfo.MagicDefense + petInfo.MagicDefenseInc * (int)petData.Level);
     }
     int awake = (int)petData.Awake;
     if (awake > 0)
     {
         AttMod attValueMod = Awake.GetAttValueMod(elementType, awake);
         if (attValueMod != null)
         {
             num += (long)attValueMod.MaxHP;
             num2 += (long)attValueMod.Attack;
             num3 += (long)attValueMod.Defense;
             num4 += (long)attValueMod.Defense;
         }
         int attPctMod = Awake.GetAttPctMod(awake);
         if (attPctMod > 0)
         {
             num5 += (long)attPctMod;
             num6 += (long)attPctMod;
             num7 += (long)attPctMod;
             num8 += (long)attPctMod;
         }
     }
     AwakeInfo info3 = Globals.Instance.AttDB.AwakeDict.GetInfo(awake + 1);
     if (info3 != null)
     {
         int itemFlag = (int)petData.ItemFlag;
         for (int i = 0; i < 4; i++)
         {
             int index = elementType * 4 + i;
             if (info3.ItemID[index] != 0 && (itemFlag & 1 << i) != 0)
             {
                 ItemInfo info4 = Globals.Instance.AttDB.ItemDict.GetInfo(info3.ItemID[index]);
                 if (info4 == null)
                 {
                     global::Debug.LogErrorFormat("ItemDict.GetInfo error, ID = {0}", new object[]
                     {
                         info3.ItemID[index]
                     });
                 }
                 else
                 {
                     if (info4.Value1 > 0)
                     {
                         num2 += (long)info4.Value1;
                     }
                     if (info4.Value2 > 0)
                     {
                         num3 += (long)info4.Value2;
                         num4 += (long)info4.Value2;
                     }
                     if (info4.Value3 > 0)
                     {
                         num += (long)info4.Value3;
                     }
                 }
             }
         }
     }
     num += (long)petData.MaxHP;
     num2 += (long)petData.Attack;
     num3 += (long)petData.PhysicDefense;
     num4 += (long)petData.MagicDefense;
     maxHP = (int)(num * (10000L + num5) / 10000L);
     attack = (int)(num2 * (10000L + num6) / 10000L);
     physicDefense = (int)(num3 * (10000L + num7) / 10000L);
     magicDefense = (int)(num4 * (10000L + num8) / 10000L);
 }
示例#36
0
 public void SetRemotePlayerData(RemotePlayer data1, RemotePlayerDetail data2)
 {
     if (data1 == null || data2 == null)
     {
         Debug.LogError(new object[]
         {
             "data1 == null || data2 == null"
         });
         return;
     }
     this.ClearRemotePlayerData();
     this.remoteID = data1.GUID;
     this.remoteName = data1.Name;
     this.remoteLevel = data1.Level;
     this.remoteFurther = data1.FurtherLevel;
     this.remoteAwake = data1.AwakeLevel;
     this.remoteAwakeItemFlag = data1.AwakeItemFlag;
     this.remoteVipLevel = data1.VipLevel;
     this.remoteGender = data1.Gender;
     this.remoteConstellationLevel = data1.ConstellationLevel;
     this.remoteFashionLevel = data2.FashionLevel;
     if (data2.Lopet != null && data2.Lopet.InfoID != 0)
     {
         LopetInfo info = Globals.Instance.AttDB.LopetDict.GetInfo(data2.Lopet.InfoID);
         if (info == null)
         {
             Debug.LogErrorFormat("LopetDict.GetInfo error, id = {0}", new object[]
             {
                 data2.Lopet.InfoID
             });
             return;
         }
         this.remoteLopet = new LopetDataEx(data2.Lopet, info);
     }
     PlayerPetInfo.Info2.Name = this.remoteName;
     PlayerPetInfo.Info2.Quality = this.GetRemoteQuality();
     PlayerPetInfo.Info2.Type = this.remoteGender;
     PetData petData = new PetData();
     if (petData == null)
     {
         Debug.LogError(new object[]
         {
             "new PetData error"
         });
         return;
     }
     petData.ID = 0uL;
     petData.InfoID = 90001;
     petData.Level = (uint)this.remoteLevel;
     petData.Further = (uint)this.remoteFurther;
     petData.Awake = (uint)this.remoteAwake;
     petData.ItemFlag = (uint)this.remoteAwakeItemFlag;
     data2.Pets.Add(petData);
     for (int i = 0; i < data2.Pets.Count; i++)
     {
         int num = (int)data2.Pets[i].ID;
         if (num >= 4)
         {
             num -= 4;
             if (num >= 6)
             {
                 Debug.LogErrorFormat("remote assist pet slot error, slot = {0}", new object[]
                 {
                     num
                 });
             }
             else
             {
                 PetInfo info2 = Globals.Instance.AttDB.PetDict.GetInfo(data2.Pets[i].InfoID);
                 if (info2 == null)
                 {
                     Debug.LogErrorFormat("PetDict.GetInfo error, id = {0}", new object[]
                     {
                         data2.Pets[i].InfoID
                     });
                 }
                 else
                 {
                     this.remoteAssistPets[num] = new PetDataEx(data2.Pets[i], info2);
                 }
             }
         }
     }
     int fashionID = data1.FashionID;
     for (int j = 0; j < 4; j++)
     {
         this.remoteSockets[j] = new SocketDataEx();
         if (this.remoteSockets[j] == null)
         {
             Debug.LogError(new object[]
             {
                 "allocate SocketDataEx error!"
             });
         }
         else
         {
             this.remoteSockets[j].Init(j, (j != 0) ? 0 : fashionID, data2);
         }
     }
     this.UpdateRemoteCombatValue();
 }