示例#1
0
 public bool LearnBlueprint(int itemID)
 {
     ProtoBuf.PersistantPlayer playerInfo = Persistence.GetPlayerInfo(GameID);
     if (!playerInfo.blueprints.complete.Contains(itemID))
     {
         playerInfo.blueprints.complete.Add(itemID);
         Persistence.SetPlayerInfo(GameID, playerInfo);
         basePlayer.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
         basePlayer.ClientRPCPlayer(null, basePlayer, "UnlockedBlueprint", itemID);
         return(true);
     }
     return(false);
 }
示例#2
0
 public void LearnBlueprints(IEnumerable <int> itemIDs)
 {
     ProtoBuf.PersistantPlayer playerInfo = Persistence.GetPlayerInfo(GameID);
     foreach (int itemid in itemIDs)
     {
         if (!playerInfo.blueprints.complete.Contains(itemid))
         {
             playerInfo.blueprints.complete.Add(itemid);
             Persistence.SetPlayerInfo(GameID, playerInfo);
             basePlayer.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
             basePlayer.ClientRPCPlayer(null, basePlayer, "UnlockedBlueprint", itemid);
         }
     }
 }
示例#3
0
        public Dictionary <int, bool> KnowsBlueprints(IEnumerable <int> itemIDs)
        {
            ProtoBuf.PersistantPlayer playerInfo = Persistence.GetPlayerInfo(GameID);
            Dictionary <int, bool>    result     = new Dictionary <int, bool>();

            foreach (int itemid in itemIDs)
            {
                if (!result.ContainsKey(itemid))
                {
                    result[itemid] = playerInfo.blueprints.complete.Contains(itemid);
                }
            }
            return(result);
        }
示例#4
0
        public Dictionary <ItemDefinition, bool> KnowsBlueprints(IEnumerable <ItemDefinition> itemdefs)
        {
            ProtoBuf.PersistantPlayer         playerInfo = Persistence.GetPlayerInfo(GameID);
            Dictionary <ItemDefinition, bool> result     = new Dictionary <ItemDefinition, bool>();

            foreach (ItemDefinition itemdef in itemdefs)
            {
                int itemid = itemdef.itemid;
                if (!result.ContainsKey(itemdef))
                {
                    result[itemdef] = playerInfo.blueprints.complete.Contains(itemid);
                }
            }
            return(result);
        }
示例#5
0
 public void LearnBlueprints(IEnumerable <ItemDefinition> itemdefs)
 {
     ProtoBuf.PersistantPlayer playerInfo = ServerMgr.Instance.persistance.GetPlayerInfo(GameID);
     foreach (ItemDefinition itemdef in itemdefs)
     {
         int itemid = itemdef.itemid;
         if (!playerInfo.blueprints.complete.Contains(itemid))
         {
             playerInfo.blueprints.complete.Add(itemid);
             ServerMgr.Instance.persistance.SetPlayerInfo(GameID, playerInfo);
             basePlayer.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
             basePlayer.ClientRPCPlayer(null, basePlayer, "UnlockedBlueprint", itemid);
         }
     }
 }
示例#6
0
        public bool LearnBlueprint(ItemDefinition itemdef)
        {
            ProtoBuf.PersistantPlayer playerInfo = ServerMgr.Instance.persistance.GetPlayerInfo(GameID);
            int itemID = itemdef.itemid;

            if (!playerInfo.blueprints.complete.Contains(itemID))
            {
                playerInfo.blueprints.complete.Add(itemID);
                ServerMgr.Instance.persistance.SetPlayerInfo(GameID, playerInfo);
                basePlayer.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
                basePlayer.ClientRPCPlayer(null, basePlayer, "UnlockedBlueprint", itemID);
                return(true);
            }
            return(false);
        }
示例#7
0
        public Dictionary <ItemBlueprint, bool> KnowsBlueprints(IEnumerable <ItemBlueprint> itemBPs)
        {
            ProtoBuf.PersistantPlayer        playerInfo = ServerMgr.Instance.persistance.GetPlayerInfo(GameID);
            Dictionary <ItemBlueprint, bool> result     = new Dictionary <ItemBlueprint, bool>();

            foreach (ItemBlueprint itembp in itemBPs)
            {
                int itemid = itembp.targetItem.itemid;
                if (!result.ContainsKey(itembp))
                {
                    result[itembp] = playerInfo.blueprints.complete.Contains(itemid);
                }
            }
            return(result);
        }
示例#8
0
        private void CheckBlueprints(BasePlayer player)
        {
            if (player.net == null)
            {
                return;
            }

            if (player.net.connection == null)
            {
                return;
            }

            if (SingletonComponent <ServerMgr> .Instance == null)
            {
                return;
            }

            if (SingletonComponent <ServerMgr> .Instance.persistance == null)
            {
                return;
            }

            bool removed = false;

            ProtoBuf.PersistantPlayer persistentPlayer = SingletonComponent <ServerMgr> .Instance.persistance.GetPlayerInfo(player.userID);

            if (persistentPlayer is ProtoBuf.PersistantPlayer)
            {
                foreach (string blocked in this.blockList)
                {
                    ItemDefinition item = ItemManager.FindItemDefinition(blocked);
                    if (item is ItemDefinition && persistentPlayer.blueprints is ProtoBuf.BlueprintList && persistentPlayer.blueprints.complete is List <int> && persistentPlayer.blueprints.complete.Contains(item.itemid))
                    {
                        persistentPlayer.blueprints.complete.Remove(item.itemid);
                        removed = true;
                    }
                }

                if (removed)
                {
                    PlayerBlueprints.InitializePersistance(persistentPlayer);
                    SingletonComponent <ServerMgr> .Instance.persistance.SetPlayerInfo(player.userID, persistentPlayer);

                    player.SendFullSnapshot();
                }
            }
        }
        private void UnlockAllBlueprints(BasePlayer player)
        {
            ProtoBuf.PersistantPlayer playerInfo = SingletonComponent <ServerMgr> .Instance.persistance.GetPlayerInfo(player.userID);

            foreach (ItemBlueprint itemBlueprint in ItemManager.bpList)
            {
                if (itemBlueprint.userCraftable && !itemBlueprint.defaultBlueprint)
                {
                    if (!playerInfo.unlockedItems.Contains(itemBlueprint.targetItem.itemid))
                    {
                        playerInfo.unlockedItems.Add(itemBlueprint.targetItem.itemid);
                    }
                }
            }
            SingletonComponent <ServerMgr> .Instance.persistance.SetPlayerInfo(player.userID, playerInfo);

            player.SendNetworkUpdateImmediate(false);
            player.ClientRPCPlayer <int>(null, player, "UnlockedBlueprint", 0);
        }
示例#10
0
 public List <int> KnownBlueprints()
 {
     ProtoBuf.PersistantPlayer playerInfo = Persistence.GetPlayerInfo(GameID);
     return(playerInfo.blueprints.complete);
 }
示例#11
0
 public bool KnowsBlueprint(ItemDefinition itemdef)
 {
     ProtoBuf.PersistantPlayer playerInfo = Persistence.GetPlayerInfo(GameID);
     return(playerInfo.blueprints.complete.Contains(itemdef.itemid));
 }
示例#12
0
 public bool KnowsBlueprint(ItemBlueprint itembp)
 {
     ProtoBuf.PersistantPlayer playerInfo = Persistence.GetPlayerInfo(GameID);
     return(playerInfo.blueprints.complete.Contains(itembp.targetItem.itemid));
 }
示例#13
0
 public bool KnowsBlueprint(int itemID)
 {
     ProtoBuf.PersistantPlayer playerInfo = Persistence.GetPlayerInfo(GameID);
     return(playerInfo.blueprints.complete.Contains(itemID));
 }