Exemplo n.º 1
0
        private void Notice(GamePlayer player, int id, string name)
        {
            float rate = (float)ShopMgr.GetLimitCountByID(id) / (float)ShopMgr.GetLimitMax(id);
            int   index;

            if (rate <= 0.7f && rate > 0.5f)
            {
                index = 0;
            }
            else
            {
                if (rate <= 0.5f && rate > 0.3f)
                {
                    index = 1;
                }
                else
                {
                    if (rate <= 0.3f && rate > 0.1f)
                    {
                        index = 2;
                    }
                    else
                    {
                        if (rate > 0.1f || rate <= 0f)
                        {
                            return;
                        }
                        index = 3;
                    }
                }
            }
            if (ShopMgr.GetIsNotice(id, index) != 0)
            {
                GSPacketIn pkg = new GSPacketIn(10);
                pkg.WriteInt(2);
                pkg.WriteString(LanguageMgr.GetTranslation("UserBuyLimitItemNotice.Content", new object[]
                {
                    name,
                    ShopMgr.GetLimitCountByID(id)
                }));
                GameServer.Instance.LoginServer.SendPacket(pkg);
                GamePlayer[] players = WorldMgr.GetAllPlayers();
                GamePlayer[] array   = players;
                for (int i = 0; i < array.Length; i++)
                {
                    GamePlayer p = array[i];
                    if (p != player)
                    {
                        p.Out.SendTCP(pkg);
                    }
                }
                ShopMgr.CloseNotice(id, index);
                GSPacketIn pkg2 = new GSPacketIn(204);
                pkg2.WriteInt(id);
                pkg2.WriteInt(index);
                GameServer.Instance.LoginServer.SendPacket(pkg2);
            }
        }
Exemplo n.º 2
0
 public void HandleUpdateShopNotice(GSPacketIn pkg)
 {
     ShopMgr.CloseNotice(pkg.ReadInt(), pkg.ReadInt());
 }