Exemple #1
0
    /// <summary>
    /// 城战基本信息 进入副本时下发一次
    /// </summary>
    /// <param name="cmd"></param>
    public void OnCityWarBaseInfo(GameCmd.stCityWarBaseInfoClanUserCmd_S cmd)
    {
        m_bEnterCityWar = true;//

        m_lstCityWarClanId      = cmd.clans_id;
        m_lstCityWarClanName    = cmd.clans_name;
        m_lstCityWarTotemBaseId = cmd.towers_base_id;
        m_lstCityWarTotemClanId = cmd.tower_clan_id;

        //图腾
        m_lstCityWarTotem = new List <CityWarTotem>();
        for (int i = 0; i < m_lstCityWarTotemBaseId.Count; i++)
        {
            CityWarTotem cityWarTotem = new CityWarTotem();
            cityWarTotem.npcBaseId = m_lstCityWarTotemBaseId[i];
            cityWarTotem.clanId    = m_lstCityWarTotemClanId[i];

            m_lstCityWarTotem.Add(cityWarTotem);

            //设置实体clanID;
            IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es != null)
            {
                INPC npc = es.FindNPCByBaseId((int)cityWarTotem.npcBaseId);
                if (npc != null)
                {
                    uint clanId     = cityWarTotem.clanId;
                    int  clanIdLow  = (int)(clanId & 0x0000ffff);
                    int  clanIdHigh = (int)(clanId >> 16);
                    npc.SetProp((int)Client.CreatureProp.ClanIdLow, clanIdLow);
                    npc.SetProp((int)Client.CreatureProp.ClanIdHigh, clanIdHigh);

                    //npc.SetProp((int)Client.CreatureProp.ClanId, (int)cityWarTotem.clanId);
                }
            }
        }

        //氏族名称
        for (int i = 0; i < m_lstCityWarTotem.Count; i++)
        {
            if (m_lstCityWarTotem[i].clanId == 0)
            {
                continue;
            }

            int    clanIndex = m_lstCityWarClanId.IndexOf(m_lstCityWarTotem[i].clanId);
            string clanName  = clanIndex < m_lstCityWarClanName.Count ? m_lstCityWarClanName[clanIndex] : "";
            m_lstCityWarTotem[i].clanName = clanName;
        }

        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.CityWarFightingPanel))
        {
            DataManager.Manager <UIPanelManager>().SendMsg(PanelID.CityWarFightingPanel, UIMsgID.eCityWarInfoUpdate, null);
        }
    }
Exemple #2
0
    /// <summary>
    /// 图腾改变状态时 发客户端
    /// </summary>
    /// <param name="cmd"></param>
    public void OnCityWarTowerChange(stCityWarTowerChangeClanUserCmd_S cmd)
    {
        //图腾NPC
        List <uint> totemNpcIdList = GameTableManager.Instance.GetGlobalConfigList <uint>(CONST_COTYWARTOTEM_NAME, (cmd.tower_idx).ToString());

        if (totemNpcIdList == null)
        {
            return;
        }

        if (cmd.tower_idx - 1 > m_lstCityWarTotem.Count)
        {
            return;
        }

        CityWarTotem cityWarTotem = m_lstCityWarTotem[(int)cmd.tower_idx - 1];

        //图腾氏族ID
        cityWarTotem.clanId = cmd.clan_id;
        //图腾npc ID
        if (cmd.clan_id != 0)
        {
            int clanIndex = m_lstCityWarClanId.IndexOf(cmd.clan_id);
            cityWarTotem.npcBaseId = totemNpcIdList[clanIndex];          //图腾对应的npc
            string clanName = clanIndex < m_lstCityWarClanName.Count ? m_lstCityWarClanName[clanIndex] : "";
            cityWarTotem.clanName = clanName;
        }
        else
        {
            cityWarTotem.npcBaseId = totemNpcIdList[totemNpcIdList.Count - 1];  //最后一个默认为中立的npc
            cityWarTotem.clanName  = string.Empty;
        }

        //设置实体clanID;
        IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();

        if (es != null)
        {
            INPC npc = es.FindNPCByBaseId((int)cityWarTotem.npcBaseId);
            if (npc != null)
            {
                uint clanId     = cityWarTotem.clanId;
                int  clanIdLow  = (int)(clanId & 0x0000ffff);
                int  clanIdHigh = (int)(clanId >> 16);
                npc.SetProp((int)Client.CreatureProp.ClanIdLow, clanIdLow);
                npc.SetProp((int)Client.CreatureProp.ClanIdHigh, clanIdHigh);

                //npc.SetProp((int)Client.CreatureProp.ClanId, (int)cityWarTotem.clanId);
            }
        }

        EventEngine.Instance().DispatchEvent((int)GameEventID.CITYWARTOTEMCLANNAMECHANGE, cityWarTotem.npcBaseId);
    }
Exemple #3
0
    public void OnPetLevelUP(stLevelUpPetUserCmd_S cmd)
    {
        IPet pet = GetPetByThisID(cmd.id);

        if (pet != null)
        {
            pet.SetProp((int)CreatureProp.Level, cmd.lv);
            pet.SetProp((int)PetProp.LevelExp, cmd.exp);
            pet.SetProp((int)PetProp.MaxPoint, cmd.max_point);
            UpdatePetProp();
            string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_zhanhunshengji, GetPetName(pet), cmd.lv);
            ChatDataManager.SendToChatSystem(txt);
            INPC npc = GetNpcByPetID(cmd.id);
            if (npc != null)
            {
                npc.SetProp((int)CreatureProp.Level, cmd.lv);
                stPropUpdate prop = new stPropUpdate();
                prop.uid        = npc.GetUID();
                prop.nPropIndex = (int)CreatureProp.Level;
                prop.newValue   = (int)cmd.lv;

                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);
            }
        }
    }
Exemple #4
0
    public void Execute(GameCmd.stChangeMoveSpeedDataUserCmd_S cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }

        switch (cmd.type)
        {
        case (uint)SceneEntryType.SceneEntry_NPC:
        {
            INPC npc = es.FindNPC(cmd.id);
            if (npc != null)
            {
                npc.SetProp((int)WorldObjProp.MoveSpeed, (int)cmd.mvspd);
                npc.SendMessage(EntityMessage.EntityCommand_SetAniSpeed, (object)1.0f);
            }
        }
        break;

        case (uint)SceneEntryType.SceneEntry_Player:
        {
            IPlayer player = es.FindPlayer(cmd.id);
            if (player != null)
            {
                player.SetProp((int)WorldObjProp.MoveSpeed, (int)cmd.mvspd);
                player.SendMessage(EntityMessage.EntityCommand_SetAniSpeed, (object)1.0f);
            }
        }
        break;

        default:
            break;
        }
    }