Ejemplo n.º 1
0
        private async Task HandleShopAsync(ShopHandler shop)
        {
            try
            {
                var collector = new MessageCollector(Context.Client);

                var options = new SessionOptions
                {
                    ResetTimeoutOnAttempt = true,
                    Timeout = TimeSpan.FromSeconds(30),
                    Session = shop
                };

                bool Filter(SocketMessage message, int index)
                {
                    return((message.Author.Id == Context.User.Id) && (message.Channel.Id == Context.Channel.Id));
                }

                await collector.MatchAsync(Filter, options);
            }
            catch (Exception e)
            {
                await Context.Channel.CatchAsync(e);
            }
        }
Ejemplo n.º 2
0
        protected void InitSystem_Click(object sender, EventArgs e)
        {
            ShopHandler s = new ShopHandler();

            s.InitSystem();
            Response.Redirect("~/Home.aspx");
        }
Ejemplo n.º 3
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            ShopHandler sh = new ShopHandler();

            sh.AddProductToBasket(Session["username"].ToString(), Session["nameShop"].ToString(), Session["barcode"].ToString(), int.Parse(Label1.Text.ToString()));
            Response.Redirect("~/Home.aspx");
        }
Ejemplo n.º 4
0
        public void Post([FromBody] PostecData pos)
        {
            //情報チェック
            if (!LoginHandler.Auth_LoginInfoCheck(pos.LoginInfo))
            {
                throw new Exception("ログイン情報不正");
            }
            if (!pos.ShopInfo.Check())
            {
                throw new Exception("店舗情報不正");
            }

            ShopHandler s = new ShopHandler();

            //店舗IDの有無で判定
            if (string.IsNullOrEmpty(pos.ShopInfo.ShopId))
            {
                //新規登録
                s.ReagistShop(pos.ShopInfo, pos.LoginInfo);
            }
            else
            {
                //更新
                //todo店舗のっとりチェック
                s.UpdateShop(pos.ShopInfo, pos.LoginInfo);
            }
            return;
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ShopHandler a = new ShopHandler();

            DataListproducts.DataSource = a.getAllStores();
            DataListproducts.DataBind();
        }
Ejemplo n.º 6
0
        public void Delete(string ShopId, string accessToken)
        {
            //所有者のIDを取得
            string id = LoginHandler.GetIdFromToken(accessToken);

            ShopHandler s = new ShopHandler();

            s.DeleteShop(ShopId, id);
        }
Ejemplo n.º 7
0
    public void Start()
    {
        //References
        shopHandler   = ShopHandler.instance;
        playerHandler = PlayerHandler.instance;
        stock         = new List <ShopItem>(shopHandler.shopData.stock);

        PurgeStock();
        DisplayStock();
    }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ShopHandler a = new ShopHandler();

                Data_shop.DataSource = a.GetUserStores(Session["username"].ToString());
                Data_shop.DataBind();
            }
        }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        if (GUILayout.Button("Populate Array"))
        {
            ShopHandler shopHandler = (ShopHandler)target;
            shopHandler.shopItems = new ShopItem[shopHandler.GetNumberOfItems()];
            shopHandler.PopulateShopArray();
        }
    }
Ejemplo n.º 10
0
        protected void ButtonSend_Click(object sender, EventArgs e)
        {
            ShopHandler s        = new ShopHandler();
            string      username = Session["username"].ToString();
            bool        open     = s.OpenShop(username, TextBoxShopname.Text, TextBoxpolicy.Text);

            if (!open)
            {
                Labelerror.Visible = true;
            }
            Response.Redirect("~/Home.aspx");
        }
Ejemplo n.º 11
0
 private void OnButtonPressed(object?sender, ButtonPressedEventArgs e)
 {
     // Thanks, RSV, for reminding me that there are other conditions for which I should probably not be handling shops....
     // From: https://github.com/Rafseazz/Ridgeside-Village-Mod/blob/816a66d0c9e667d3af662babc170deed4070c9ff/Ridgeside%20SMAPI%20Component%202.0/RidgesideVillage/TileActionHandler.cs#L37
     if (!Context.IsWorldReady || !Context.CanPlayerMove || Game1.player.isRidingHorse() ||
         Game1.currentLocation is null || Game1.eventUp || Game1.isFestival() || Game1.IsFading())
     {
         return;
     }
     ShopHandler.HandleWillyShop(e);
     ShopHandler.HandleSandyShop(e);
 }
Ejemplo n.º 12
0
        public override void OnLoad()
        {
            Chat.Print(
                string.Format(
                    "<font color=\"#40c1ff\">[AIBuddy]:</font> <font color=\"#ffffff\">{0} loaded</font>",
                    this.MapId));

            this.shopHandler = new ShopHandler();
            FindChampion.FindAndSetChampion();
            this.Rebuild();
            this.m_shopBehaviour.Start(null);
            this.m_moveBehaviour.Start(null);
        }
Ejemplo n.º 13
0
        public object Get(string id, string shopId, bool auth)
        {
            ShopHandler s = new ShopHandler();

            if (string.IsNullOrEmpty(shopId))
            {
                return(s.GetUsersShops(id)); //特定のユーザーに紐付く書店一覧を返す
            }
            else
            {
                return(s.GetShop(shopId)); //特定の書店の情報を返す
            }
        }
Ejemplo n.º 14
0
        protected void DataListCart_ItemCommand1(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName == "Delete_command")
            {
                string[] cargs = e.CommandArgument.ToString().Split(',');
                Session["productName"] = cargs[0];
                Session["descerption"] = cargs[1];
                Session["barcode"]     = cargs[2];
                Session["catagory"]    = cargs[3];
                Session["price"]       = cargs[4];
                Session["nameShop"]    = cargs[5];
                Session["Amount"]      = cargs[6];

                ShopHandler s = new ShopHandler();
                bool        b = s.remove_item_from_cart(Session["username"].ToString(), Session["nameShop"].ToString(), Session["barcode"].ToString(), int.Parse(Session["Amount"].ToString()));
                if (b)
                {
                    ShopHandler c = new ShopHandler();

                    Data_cart.DataSource = c.GetUserBaskets(Session["username"].ToString());
                    Data_cart.DataBind();
                }
                else
                {
                }
            }

            if (e.CommandName == "up_command")
            {
                string[] cargs = e.CommandArgument.ToString().Split(',');
                Session["productName"] = cargs[0];
                Session["barcode"]     = cargs[1];
                Session["nameShop"]    = cargs[2];
                Session["Amount"]      = cargs[3];

                ShopHandler s = new ShopHandler();
                s.UpdateCart(Session["username"].ToString(), Session["nameShop"].ToString(), Session["barcode"].ToString(), int.Parse(Session["Amount"].ToString()) + 1);
                Response.Redirect("~/Cart.aspx");
            }
            if (e.CommandName == "down_command")
            {
                string[] cargs = e.CommandArgument.ToString().Split(',');
                Session["productName"] = cargs[0];
                Session["barcode"]     = cargs[1];
                Session["nameShop"]    = cargs[2];
                Session["Amount"]      = cargs[3];
                ShopHandler s = new ShopHandler();
                s.UpdateCart(Session["username"].ToString(), Session["nameShop"].ToString(), Session["barcode"].ToString(), int.Parse(Session["Amount"].ToString()) - 1);
                Response.Redirect("~/Cart.aspx");
            }
        }
Ejemplo n.º 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["keyword"] != null)
     {
         ShopHandler a = new ShopHandler();
         DataListproducts.DataSource = a.search(Request.QueryString["keyword"].ToString());
         DataListproducts.DataBind();
     }
     else
     {
         ShopHandler a = new ShopHandler();
         DataListproducts.DataSource = a.getAllProducts();
         DataListproducts.DataBind();
     }
 }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Labelerrorcreditcard.Visible = false;
                Labelerroraddress.Visible    = false;
                ShopHandler a = new ShopHandler();

                Data_cart.DataSource = a.GetUserBaskets(Session["username"].ToString());
                Data_cart.DataBind();
            }
            else
            {
            }
        }
Ejemplo n.º 17
0
    /**
     * 客户端请求商品信息
     * @param shopList 商品信息
     */
    public void GC_SHOP_LIST(InputMessage data)
    {
        int       i, size;
        ArrayList shopList = new ArrayList();

        size = data.GetShort();
        for (i = 0; i < size; i++)
        {
            ShopInfoData shopList_Datas = new ShopInfoData();
            shopList_Datas.shopId = data.GetInt();           //商品id
            shopList_Datas.price  = data.GetInt();           //商品价格
            shopList.Add(shopList_Datas);
        }
        ShopHandler.Instance().GC_SHOP_LIST(shopList);
    }
Ejemplo n.º 18
0
        protected void ButtonAdd_Click(object sender, EventArgs e)
        {
            ShopHandler a = new ShopHandler();

            if (!a.AddNewProductToSystem(TextBoxbarcode.Text.ToString(), TextBoxproductName.Text.ToString(), TextBoxdescription.Text.ToString()
                                         , double.Parse(TextBoxprice.Text.ToString()), TextBoxcategories.Text.ToString()))
            {
                Labelerrorbarcode.Visible = true;
            }
            else
            {
                a.AddItemToStore(Session["editshop"].ToString(), TextBoxbarcode.Text.ToString(), int.Parse(TextBoxAmount.Text.ToString()));
                table1.Visible = false;
                DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText("Select"));
            }
        }
Ejemplo n.º 19
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            ShopHandler s = new ShopHandler();

            if (TextBoxCreditcard.Text.Length == 0)
            {
                Labelerrorcreditcard.Visible = true;
            }
            else if (TextBoxaddress.Text.Length == 0)
            {
                Labelerroraddress.Visible = true;
            }
            else
            {
                s.Purchase(Session["username"].ToString(), TextBoxCreditcard.Text.ToString());
            }
            Response.Redirect("~/PurchaseDone.aspx");
        }
Ejemplo n.º 20
0
        public async Task ShopAsync()
        {
            Husk husk = Context.Account.Husk;

            if (!Engine.CanAct(ref husk, Context.Brain))
            {
                await Context.Channel.SendMessageAsync("You are currently desynchronized. Unable to establish connection.");

                return;
            }
            Context.Account.Husk = husk;

            if (Engine.CanShopAt(Context.Account.Husk, out Market market))
            {
                ShopHandler shop = new ShopHandler(Context, market, PaletteType.Glass);
                await HandleShopAsync(shop);
            }
            else
            {
                await Context.Channel.SendMessageAsync(Context.Account, "An error has occurred when initializing the shop.");
            }
        }
Ejemplo n.º 21
0
 void Awake()
 {
     instance = this;
     GetShopItemToUseFromPlayerPrefs();
 }
Ejemplo n.º 22
0
 private void OnPlayerWarped(object?sender, WarpedEventArgs e)
 {
     ShopHandler.AddBoxToShop(e);
 }
Ejemplo n.º 23
0
    /**
     * 客户端购买成功
     * @param shopId 商品id
     */
    public void GC_BUY_ITEM(InputMessage data)
    {
        int shopId = data.GetInt();

        ShopHandler.Instance().GC_BUY_ITEM(shopId);
    }
Ejemplo n.º 24
0
    private static void HandleRespond(GameSession session, PacketReader packet)
    {
        List <QuestStatus> npcQuests = new();
        int objectId = packet.ReadInt();

        // Find if npc object id exists in field manager
        if (!session.FieldManager.State.Npcs.TryGetValue(objectId, out IFieldActor <NpcMetadata> npc))
        {
            return;
        }

        // Get all quests for this npc
        foreach (QuestStatus item in session.Player.QuestData.Values.Where(x => x.State is not QuestState.Finished))
        {
            if (npc.Value.Id == item.StartNpcId)
            {
                npcQuests.Add(item);
            }

            if (item.State is QuestState.Started && npc.Value.Id == item.CompleteNpcId && !npcQuests.Contains(item))
            {
                npcQuests.Add(item);
            }
        }

        session.Player.NpcTalk = new(npc.Value, npcQuests);
        NpcTalk npcTalk = session.Player.NpcTalk;

        ScriptLoader scriptLoader = new($"Npcs/{npc.Value.Id}", session);

        // If NPC is a shop, load and open the shop
        if (npc.Value.IsShop())
        {
            ShopHandler.HandleOpen(session, npc);
            return;
        }

        if (npc.Value.IsBank())
        {
            session.Send(HomeBank.OpenBank());
            return;
        }

        if (npc.Value.IsBeauty())
        {
            NpcMetadata npcTarget = NpcMetadataStorage.GetNpcMetadata(npcTalk.Npc.Id);
            if (npcTarget.ShopId == 507) // mirror
            {
                session.Send(NpcTalkPacket.Respond(npc, NpcType.Default, DialogType.Beauty, 0));
                HandleBeauty(session);
                return;
            }

            session.Send(NpcTalkPacket.Respond(npc, NpcType.Default, DialogType.Beauty, 1));
            return;
        }

        // Check if npc has an exploration quest
        QuestHelper.UpdateExplorationQuest(session, npc.Value.Id.ToString(), "talk_in");

        // If npc has quests, send quests and talk option
        if (npcQuests.Count != 0)
        {
            // Check if npc has scripts available
            if (ScriptMetadataStorage.NpcHasScripts(npc.Value.Id))
            {
                npcTalk.ScriptId = 0;
                session.Send(QuestPacket.SendDialogQuest(objectId, npcQuests));
                session.Send(NpcTalkPacket.Respond(npc, NpcType.QuestOptions, DialogType.TalkOption, npcTalk.ScriptId));
                return;
            }

            // If npc has no scripts, send the quest script id
            npcTalk.IsQuest = true;
            npcTalk.QuestId = npcQuests.First().Id;

            ScriptMetadata questScript = ScriptMetadataStorage.GetQuestScriptMetadata(npcTalk.QuestId);
            npcTalk.ScriptId = GetNextScript(questScript, npcTalk, 0, scriptLoader, session.Player);

            session.Send(QuestPacket.SendDialogQuest(objectId, npcQuests));
            session.Send(NpcTalkPacket.Respond(npc, NpcType.Quest, DialogType.CloseNext, npcTalk.ScriptId));
            return;
        }

        ScriptMetadata scriptMetadata = ScriptMetadataStorage.GetNpcScriptMetadata(npc.Value.Id);

        if (!scriptMetadata.Options.Exists(x => x.Type == ScriptType.Script))
        {
            return;
        }

        int firstScriptId = GetFirstScriptId(scriptLoader, scriptMetadata);

        npcTalk.ScriptId = firstScriptId;

        Option option = scriptMetadata.Options.First(x => x.Id == firstScriptId);

        DialogType dialogType = option.Contents[0].Distractor is null ? DialogType.Close1 : DialogType.CloseNextWithDistractor;

        session.Send(NpcTalkPacket.Respond(npc, NpcType.NormalTalk, dialogType, firstScriptId));

        // If npc has buttonset roulette, send roulette id 13.
        // TODO: Send the correct roulette id
        if (scriptMetadata.Options.Any(x => x.ButtonSet == "roulette"))
        {
            session.Send(NpcTalkPacket.Action(ActionType.OpenWindow, "RouletteDialog", "13"));
        }
    }
Ejemplo n.º 25
0
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList2.Items.Clear();
            DropDownList3.Items.Clear();
            DropDownList4.Items.Clear();
            DropDownList5.Items.Clear();

            if (DropDownList1.SelectedItem.Text == "Select")
            {
                table1.Visible = false;
                table2.Visible = false;
                table3.Visible = false;
                table4.Visible = false;
                table5.Visible = false;
            }

            if (DropDownList1.SelectedItem.Text == "Add New Item")
            {
                table1.Visible = true;
                table2.Visible = false;
                table3.Visible = false;
                table4.Visible = false;
                table5.Visible = false;
            }
            if (DropDownList1.SelectedItem.Text == "Add New Manager")
            {
                table1.Visible = false;
                table2.Visible = true;
                table3.Visible = false;
                table4.Visible = false;
                table5.Visible = false;

                ShopHandler b = new ShopHandler();
                DataSet     d = b.GetAllUserNamesInSystem();
                DataSet     m = b.GetStoreManagers(Session["editshop"].ToString());
                int         c = 1;


                List <string> d1 = new List <string>();

                d1.Add(Session["username"].ToString());
                for (int j = 0; j < m.Tables[0].Rows.Count; j++)
                {
                    d1.Add(m.Tables[0].Rows[j]["username"].ToString());
                }

                DropDownList2.Items.Insert(0, new ListItem("please select a Manager"));

                for (int i = 0; i < d.Tables[0].Rows.Count; i++)
                {
                    if (!(d1.Contains(d.Tables[0].Rows[i]["username"].ToString())))
                    {
                        DropDownList2.Items.Insert(c, new ListItem(d.Tables[0].Rows[i]["username"].ToString()));
                        c++;
                    }
                }
            }
            if (DropDownList1.SelectedItem.Text == "Add New Owner")
            {
                table1.Visible = false;
                table2.Visible = false;
                table3.Visible = true;
                table4.Visible = false;
                table5.Visible = false;

                ShopHandler b = new ShopHandler();
                DataSet     d = b.GetAllUserNamesInSystem();


                DataSet m = b.GetStoreOwners(Session["editshop"].ToString());
                int     c = 1;


                List <string> d1 = new List <string>();

                d1.Add(Session["username"].ToString());
                for (int j = 0; j < m.Tables[0].Rows.Count; j++)
                {
                    d1.Add(m.Tables[0].Rows[j]["username"].ToString());
                }

                DropDownList3.Items.Insert(0, new ListItem("please select a Owner"));

                for (int i = 0; i < d.Tables[0].Rows.Count; i++)
                {
                    if (!(d1.Contains(d.Tables[0].Rows[i]["username"].ToString())))
                    {
                        DropDownList3.Items.Insert(c, new ListItem(d.Tables[0].Rows[i]["username"].ToString()));
                        c++;
                    }
                }
            }
            if (DropDownList1.SelectedItem.Text == "Fire Manager")
            {
                table1.Visible = false;
                table2.Visible = false;
                table3.Visible = false;
                table4.Visible = true;
                table5.Visible = false;

                ShopHandler b = new ShopHandler();
                DataSet     d = b.GetStoreManagers(Session["editshop"].ToString());
                DropDownList4.Items.Add(new ListItem("please select a Manager", "0"));
                for (int i = 0; i < d.Tables[0].Rows.Count; i++)
                {
                    DropDownList4.Items.Insert(i, new ListItem(d.Tables[0].Rows[i]["username"].ToString()));
                }
                firegif.Visible = true;
            }
            if (DropDownList1.SelectedItem.Text == "Fire Owner")
            {
                table1.Visible = false;
                table2.Visible = false;
                table3.Visible = false;
                table4.Visible = false;
                table5.Visible = true;

                ShopHandler b = new ShopHandler();
                DataSet     d = b.GetStoreOwners(Session["editshop"].ToString());
                DropDownList5.Items.Add(new ListItem("please select a Owner", "0"));
                for (int i = 0; i < d.Tables[0].Rows.Count; i++)
                {
                    if (!d.Tables[0].Rows[i]["username"].ToString().Equals(Session["username"]))
                    {
                        DropDownList5.Items.Insert(i, new ListItem(d.Tables[0].Rows[i]["username"].ToString()));
                    }
                }
                firegif.Visible = true;
            }
        }
Ejemplo n.º 26
0
 public void Awake()
 {
     instance = this;
     path     = Application.persistentDataPath + "/" + filename;
     ReadData();
 }
Ejemplo n.º 27
0
 public static void Main(string[] args)
 {
     ShopHandler.OpenShopForBusiness(31);
 }
Ejemplo n.º 28
0
 void Awake()
 {
     instance = this;
 }
Ejemplo n.º 29
0
        // GET: Admin/Category
        public ActionResult Index()
        {
            List <Sizes> modelList = new ShopHandler().GetSizes().ToList();

            return(View(modelList));
        }
Ejemplo n.º 30
0
        public override void OnLoad()
        {
            Chat.Print(
                string.Format(
                    "<font color=\"#40c1ff\">[AIBuddy]:</font> <font color=\"#ffffff\">{0} loaded</font>",
                    this.MapId));

            this.shopHandler = new ShopHandler();
            FindChampion.FindAndSetChampion();
            this.Rebuild();
            this.m_shopBehaviour.Start(null);
            this.m_moveBehaviour.Start(null);
        }
Ejemplo n.º 31
0
    private static void HandleBegin(GameSession session, PacketReader packet)
    {
        int objectId = packet.ReadInt();
        List <QuestStatus> npcQuests = new();
        int contentIndex             = 0;

        // Find if npc object id exists in field manager
        if (!session.FieldManager.State.Npcs.TryGetValue(objectId, out Npc npc))
        {
            return;
        }

        // Get all quests for this npc
        foreach (QuestStatus item in session.Player.QuestData.Values.Where(x => x.State is not QuestState.Completed))
        {
            if (npc.Value.Id == item.StartNpcId)
            {
                npcQuests.Add(item);
            }

            if (item.State is QuestState.Started && npc.Value.Id == item.CompleteNpcId && !npcQuests.Contains(item))
            {
                npcQuests.Add(item);
            }
        }

        session.Player.NpcTalk = new(npc.Value, npcQuests);
        NpcTalk npcTalk = session.Player.NpcTalk;

        ScriptMetadata scriptMetadata = ScriptMetadataStorage.GetNpcScriptMetadata(npc.Value.Id);
        NpcKind        kind           = npc.Value.NpcMetadataBasic.Kind;

        // need to find script properly before continuing
        NpcScript npcScript = GetFirstScript(session, scriptMetadata, npcTalk, npcQuests);

        switch (kind)
        {
        // reputation NPCs only have UI Dialog Type even if they have quests to accept/accepted.
        case NpcKind.SkyLumiknightCommander:
        case NpcKind.SkyGreenHoodCommander:
        case NpcKind.SkyDarkWindCommander:
        case NpcKind.SkyMapleAllianceCommander:
        case NpcKind.SkyRoyalGuardCommander:
        case NpcKind.KritiasLumiknightCommander:
        case NpcKind.KritiasGreenHoodCommander:
        case NpcKind.KritiasMapleAllianceCommander:
        case NpcKind.Humanitas:
            npcTalk.DialogType = DialogType.UI;
            ShopHandler.HandleOpen(session, npc, npc.Value.Id);
            break;

        case NpcKind.BalmyShop:
        case NpcKind.FixedShop:
        case NpcKind.RotatingShop:
            ShopHandler.HandleOpen(session, npc, npc.Value.Id);
            break;

        case NpcKind.Storage:
        case NpcKind.BlackMarket:
        case NpcKind.Birthday:     // TODO: needs a special case? select if birthday. script if not
            npcTalk.DialogType = DialogType.UI;
            break;
        }

        npcTalk.ScriptId = npcScript?.Id ?? 0;
        ResponseSelection responseSelection = GetResponseSelection(kind, npcTalk.DialogType, contentIndex, npcScript);

        if (npcTalk.DialogType.HasFlag(DialogType.Quest))
        {
            session.Send(QuestPacket.SendDialogQuest(objectId, npcQuests));
        }

        QuestManager.OnTalkNpc(session.Player, npc.Value.Id, npcTalk.ScriptId);
        session.Send(NpcTalkPacket.Respond(npc, npcTalk.DialogType, contentIndex, responseSelection, npcTalk.ScriptId));

        if (npcScript != null)
        {
            npcTalk.TalkFunction(session, npcScript.Contents[npcTalk.ContentIndex].FunctionId, "preTalkActions");
        }
    }