예제 #1
0
    public static void RPC_S2C_RequestUGCData(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int[] objIDs = stream.Read <int[]>();
        foreach (int id in objIDs)
        {
            CreationData data = CreationMgr.GetCreation(id);
            if (null == data)
            {
                CreationOriginData cData = CreationList.Find(iter => iter.ObjectID == id);
                if (cData != null)
                {
                    CreationMgr.NewCreation(cData.ObjectID, cData.HashCode, (float)cData.Seed);
                }
                else
                {
                    MessageBox_N.ShowOkBox(PELocalization.GetString(8000500));
                    LogManager.Error("Creation item create failed. ID:" + id);
                    GameClientNetwork.Disconnect();
                }

                return;
            }

            ItemProto item = ItemProto.GetItemData(id);
            if (null != item)
            {
                byte[] itemData = ItemProto.GetBuffer(item);
                NetworkManager.SyncServer(EPacketType.PT_Common_UGCItem, id, itemData);

                var components = from component in data.m_IsoData.m_Components
                                 where VCUtils.IsSeat(component.m_Type)
                                 select(int) component.m_Type;

                float hp     = data.m_Attribute.m_Durability;
                float energy = data.m_Attribute.m_MaxFuel;

                if (components.Count() >= 1)
                {
                    NetworkManager.SyncServer(EPacketType.PT_Common_UGCData, id, hp, energy,
                                              data.m_Attribute.m_Cost.Keys.ToArray(), data.m_Attribute.m_Cost.Values.ToArray(), true,
                                              components.ToArray());
                }
                else
                {
                    NetworkManager.SyncServer(EPacketType.PT_Common_UGCData, id, hp, energy,
                                              data.m_Attribute.m_Cost.Keys.ToArray(), data.m_Attribute.m_Cost.Values.ToArray(), false);
                }
            }
        }
    }
예제 #2
0
    public static CreationData GetCreation(int objId)
    {
        CreationOriginData cData = CreationList.Find(iter => iter.ObjectID == objId);

        if (cData != null)
        {
            ItemProto.Mgr.Instance.Remove(objId);

            /*CreationData data = */ CreationMgr.NewCreation(cData.ObjectID, cData.HashCode, (float)cData.Seed);
//			if(data != null && cData.HP != -1 && cData.Fuel != -1)
//			{
//				data.m_Hp = cData.HP;
//				data.m_Fuel = cData.Fuel;
//			}

            return(CreationMgr.GetCreation(objId));
        }
        else
        {
            return(null);
        }
    }