private void _setMessageHistory()
        {
            if (_completedQuests.Count == 0)
            {
                AddItemToList(new QuestProgressDialogListItem(this, 0)
                {
                    QuestName     = OldWorld.GetString(EOResourceID.QUEST_DID_NOT_FINISH_ANY),
                    QuestStep     = " ",
                    ShowIcons     = false,
                    QuestProgress = " "
                }, false);

                return;
            }

            int ndx = 0;

            foreach (string quest in _completedQuests)
            {
                AddItemToList(new QuestHistoryDialogListItem(this, ndx++)
                {
                    QuestName = quest
                }, false);
            }
        }
Esempio n. 2
0
        public void RemoveMember(short memberID)
        {
            int memberIndex = m_members.FindIndex(_member => _member.ID == memberID);

            if (memberIndex < 0 || memberIndex >= m_members.Count)
            {
                return;
            }

            if (!((EOGame)Game).API.PartyRemovePlayer(m_members[memberIndex].ID))
            {
                ((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
            }

            string name = m_members[memberIndex].Name;

            m_members.RemoveAt(memberIndex);
            m_buttons[memberIndex].SetParent(null);
            m_buttons[memberIndex].Close();
            m_buttons.RemoveAt(memberIndex);

            m_numMembers.Text = "" + m_members.Count;
            m_scrollBar.UpdateDimensions(m_members.Count);
            if (m_members.Count <= m_scrollBar.LinesToRender)
            {
                m_scrollBar.ScrollToTop();
            }

            ((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_INFORMATION, name, EOResourceID.STATUS_LABEL_PARTY_LEFT_YOUR);
            ((EOGame)Game).Hud.AddChat(ChatTab.System, "", name + " " + OldWorld.GetString(EOResourceID.STATUS_LABEL_PARTY_LEFT_YOUR), ChatIcon.PlayerPartyDark, ChatColor.PM);
        }
Esempio n. 3
0
        public OldEOPartyPanel(XNAPanel parent)
            : base(null, null, parent)
        {
            _setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

            m_removeTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 43);
            m_buttons       = new List <XNAButton>();

            //will tint this different colors for health bar and fill a rectangle
            m_healthBar             = new Texture2D[4];
            m_healthBar[HP_OUTLINE] = Game.Content.Load <Texture2D>("Party\\hp-outline");
            m_healthBar[HP_RED]     = Game.Content.Load <Texture2D>("Party\\hp-red");
            m_healthBar[HP_YELLOW]  = Game.Content.Load <Texture2D>("Party\\hp-yellow");
            m_healthBar[HP_GREEN]   = Game.Content.Load <Texture2D>("Party\\hp-green");

            m_numMembers = new XNALabel(new Rectangle(455, 2, 27, 14), Constants.FontSize08pt5)
            {
                AutoSize  = false,
                ForeColor = ColorConstants.LightGrayText,
                TextAlign = LabelAlignment.MiddleRight
            };
            m_numMembers.SetParent(this);

            m_scrollBar = new OldScrollBar(this, new Vector2(467, 20), new Vector2(16, 97), ScrollBarColors.LightOnMed)
            {
                LinesToRender = 7,
                Visible       = true
            };
            m_scrollBar.SetParent(this);
            OldWorld.IgnoreDialogs(m_scrollBar);
        }
Esempio n. 4
0
        private void _setTextForLanguage()
        {
            m_leftSide[0].Text = OldWorld.GetString(w.SoundEnabled ? EOResourceID.SETTING_ENABLED : EOResourceID.SETTING_DISABLED);
            m_leftSide[1].Text = OldWorld.GetString(w.MusicEnabled ? EOResourceID.SETTING_ENABLED : EOResourceID.SETTING_DISABLED);
            m_leftSide[2].Text = OldWorld.GetString(EOResourceID.SETTING_KEYBOARD_ENGLISH);
            m_leftSide[3].Text = OldWorld.GetString(EOResourceID.SETTING_LANG_CURRENT);
            m_leftSide[4].Text = OldWorld.GetString(w.HearWhispers ? EOResourceID.SETTING_ENABLED : EOResourceID.SETTING_DISABLED);

            m_rightSide[0].Text = OldWorld.GetString(w.ShowChatBubbles ? EOResourceID.SETTING_ENABLED : EOResourceID.SETTING_DISABLED);
            m_rightSide[1].Text = OldWorld.GetString(w.ShowShadows ? EOResourceID.SETTING_ENABLED : EOResourceID.SETTING_DISABLED);
            if (w.StrictFilterEnabled)
            {
                m_rightSide[2].Text = OldWorld.GetString(EOResourceID.SETTING_EXCLUSIVE);
            }
            else if (w.CurseFilterEnabled)
            {
                m_rightSide[2].Text = OldWorld.GetString(EOResourceID.SETTING_NORMAL);
            }
            else
            {
                m_rightSide[2].Text = OldWorld.GetString(EOResourceID.SETTING_DISABLED);
            }

            m_rightSide[3].Text = OldWorld.GetString(w.LogChatToFile ? EOResourceID.SETTING_ENABLED : EOResourceID.SETTING_DISABLED);
            m_rightSide[4].Text = OldWorld.GetString(w.Interaction ? EOResourceID.SETTING_ENABLED : EOResourceID.SETTING_DISABLED);
        }
        private void _setMessageProgress()
        {
            if (_questInfo.Count == 0)
            {
                AddItemToList(new QuestProgressDialogListItem(this, 0)
                {
                    QuestName     = OldWorld.GetString(EOResourceID.QUEST_DID_NOT_START_ANY),
                    QuestStep     = " ",
                    ShowIcons     = false,
                    QuestProgress = " "
                }, false);

                return;
            }

            int ndx = 0;

            foreach (var quest in _questInfo)
            {
                var nextItem = new QuestProgressDialogListItem(this, ndx++)
                {
                    QuestName        = quest.Name,
                    QuestStep        = quest.Description,
                    QuestContextIcon = quest.IconIndex,
                    QuestProgress    = quest.Target > 0 ? $"{quest.Progress} / {quest.Target}" : "n / a"
                };
                AddItemToList(nextItem, false);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// This Constructor should be used for all values in ChatTabs
        /// </summary>
        public OldChatTab(ChatTab tab, OldChatRenderer parentRenderer, bool selected = false)
            : base(null, null, parentRenderer)
        {
            WhichTab = tab;

            tabLabel = new XNALabel(new Rectangle(14, 2, 1, 1), Constants.FontSize08);
            tabLabel.SetParent(this);

            switch (WhichTab)
            {
            case ChatTab.Local: tabLabel.Text = "scr";  break;

            case ChatTab.Global: tabLabel.Text = "glb"; break;

            case ChatTab.Group: tabLabel.Text = "grp"; break;

            case ChatTab.System: tabLabel.Text = "sys"; break;

            case ChatTab.Private1:
            case ChatTab.Private2:
                tabLabel.Text = "[priv " + ((int)WhichTab + 1) + "]";
                break;
            }
            Selected = selected;

            relativeTextPos = new Vector2(20, 3);

            //568 331
            scrollBar = new OldScrollBar(parent, new Vector2(467, 2), new Vector2(16, 97), ScrollBarColors.LightOnMed)
            {
                Visible       = selected,
                LinesToRender = 7
            };
            OldWorld.IgnoreDialogs(scrollBar);
        }
Esempio n. 7
0
        private void _showRequirements(Skill skill)
        {
            m_showingRequirements = true;
            ClearItemList();

            List <string> drawStrings = new List <string>(15)
            {
                OldWorld.Instance.ESF.Data[skill.ID].Name + (skill.ClassReq > 0 ? " [" + OldWorld.Instance.ECF.Data[skill.ClassReq].Name + "]" : ""),
                " "
            };

            if (skill.SkillReq.Any(x => x != 0))
            {
                drawStrings.AddRange(from req in skill.SkillReq where req != 0 select OldWorld.GetString(EOResourceID.SKILLMASTER_WORD_SKILL) + ": " + OldWorld.Instance.ESF.Data[req].Name);
                drawStrings.Add(" ");
            }

            if (skill.StrReq > 0)
            {
                drawStrings.Add(skill.StrReq + " " + OldWorld.GetString(EOResourceID.SKILLMASTER_WORD_STRENGTH));
            }
            if (skill.IntReq > 0)
            {
                drawStrings.Add(skill.IntReq + " " + OldWorld.GetString(EOResourceID.SKILLMASTER_WORD_INTELLIGENCE));
            }
            if (skill.WisReq > 0)
            {
                drawStrings.Add(skill.WisReq + " " + OldWorld.GetString(EOResourceID.SKILLMASTER_WORD_WISDOM));
            }
            if (skill.AgiReq > 0)
            {
                drawStrings.Add(skill.AgiReq + " " + OldWorld.GetString(EOResourceID.SKILLMASTER_WORD_AGILITY));
            }
            if (skill.ConReq > 0)
            {
                drawStrings.Add(skill.ConReq + " " + OldWorld.GetString(EOResourceID.SKILLMASTER_WORD_CONSTITUTION));
            }
            if (skill.ChaReq > 0)
            {
                drawStrings.Add(skill.ChaReq + " " + OldWorld.GetString(EOResourceID.SKILLMASTER_WORD_CHARISMA));
            }

            drawStrings.Add(" ");
            drawStrings.Add(skill.LevelReq + " " + OldWorld.GetString(EOResourceID.SKILLMASTER_WORD_LEVEL));
            drawStrings.Add(skill.GoldReq + " " + OldWorld.Instance.EIF[1].Name);

            foreach (string s in drawStrings)
            {
                ListDialogItem nextLine = new ListDialogItem(this, ListDialogItem.ListItemStyle.Small)
                {
                    Text = s
                };
                AddItemToList(nextLine, false);
            }
        }
Esempio n. 8
0
        private void _showForgetAllMessage(Action forgetAllAction)
        {
            List <string> drawStrings = new List <string>();

            string[] messages =
            {
                OldWorld.GetString(EOResourceID.SKILLMASTER_FORGET_ALL),
                OldWorld.GetString(EOResourceID.SKILLMASTER_FORGET_ALL_MSG_1),
                OldWorld.GetString(EOResourceID.SKILLMASTER_FORGET_ALL_MSG_2),
                OldWorld.GetString(EOResourceID.SKILLMASTER_FORGET_ALL_MSG_3),
                OldWorld.GetString(EOResourceID.SKILLMASTER_CLICK_HERE_TO_FORGET_ALL)
            };

            TextSplitter ts = new TextSplitter("", Game.Content.Load <SpriteFont>(Constants.FontSize08pt5))
            {
                LineLength = 200
            };

            foreach (string s in messages)
            {
                ts.Text = s;
                if (!ts.NeedsProcessing)
                {
                    //no text clipping needed
                    drawStrings.Add(s);
                    drawStrings.Add(" ");
                    continue;
                }

                drawStrings.AddRange(ts.SplitIntoLines());
                drawStrings.Add(" ");
            }

            //now need to take the processed draw strings and make an ListDialogItem for each one
            foreach (string s in drawStrings)
            {
                string next = s;
                bool   link = false;
                if (next.Length > 0 && next[0] == '*')
                {
                    next = next.Remove(0, 1);
                    link = true;
                }
                ListDialogItem nextItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Small)
                {
                    Text = next
                };
                if (link)
                {
                    nextItem.SetPrimaryTextLink(forgetAllAction);
                }
                AddItemToList(nextItem, false);
            }
        }
Esempio n. 9
0
        public void AddMember(PartyMember member)
        {
            m_members.Add(member);

            m_numMembers.Text = $"{m_members.Count}";
            m_scrollBar.UpdateDimensions(m_members.Count);

            _addRemoveButtonForMember(member);

            ((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_INFORMATION, member.Name, EOResourceID.STATUS_LABEL_PARTY_JOINED_YOUR);
            ((EOGame)Game).Hud.AddChat(ChatTab.System, "", member.Name + " " + OldWorld.GetString(EOResourceID.STATUS_LABEL_PARTY_JOINED_YOUR), ChatIcon.PlayerParty, ChatColor.PM);
        }
Esempio n. 10
0
        private void _craftItem(CraftItem item)
        {
            if (m_state != ShopState.Crafting)
            {
                return;
            }

            var craftItemRec = OldWorld.Instance.EIF[item.ID];

            // ReSharper disable once LoopCanBeConvertedToQuery
            foreach (var ingredient in item.Ingredients)
            {
                if (OldWorld.Instance.MainPlayer.ActiveCharacter.Inventory.FindIndex(_item => _item.ItemID == ingredient.Item1 && _item.Amount >= ingredient.Item2) < 0)
                {
                    string _message = OldWorld.GetString(EOResourceID.DIALOG_SHOP_CRAFT_MISSING_INGREDIENTS) + "\n\n";
                    foreach (var ingred in item.Ingredients)
                    {
                        var localRec = OldWorld.Instance.EIF[ingred.Item1];
                        _message += $"+  {ingred.Item2}  {localRec.Name}\n";
                    }
                    string _caption =
                        $"{OldWorld.GetString(EOResourceID.DIALOG_SHOP_CRAFT_INGREDIENTS)} {OldWorld.GetString(EOResourceID.DIALOG_WORD_FOR)} {craftItemRec.Name}";
                    EOMessageBox.Show(_message, _caption, EODialogButtons.Cancel, EOMessageBoxStyle.LargeDialogSmallHeader);
                    return;
                }
            }

            if (!EOGame.Instance.Hud.InventoryFits((short)item.ID))
            {
                EOMessageBox.Show(OldWorld.GetString(EOResourceID.DIALOG_TRANSFER_NOT_ENOUGH_SPACE),
                                  OldWorld.GetString(EOResourceID.STATUS_LABEL_TYPE_WARNING),
                                  EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                return;
            }

            string _message2 = OldWorld.GetString(EOResourceID.DIALOG_SHOP_CRAFT_PUT_INGREDIENTS_TOGETHER) + "\n\n";

            foreach (var ingred in item.Ingredients)
            {
                var localRec = OldWorld.Instance.EIF[ingred.Item1];
                _message2 += $"+  {ingred.Item2}  {localRec.Name}\n";
            }
            string _caption2 =
                $"{OldWorld.GetString(EOResourceID.DIALOG_SHOP_CRAFT_INGREDIENTS)} {OldWorld.GetString(EOResourceID.DIALOG_WORD_FOR)} {craftItemRec.Name}";

            EOMessageBox.Show(_message2, _caption2, EODialogButtons.OkCancel, EOMessageBoxStyle.LargeDialogSmallHeader, (o, e) =>
            {
                if (e.Result == XNADialogResult.OK && !m_api.CraftItem((short)item.ID))
                {
                    EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                }
            });
        }
Esempio n. 11
0
        public EmptySpellIcon(OldActiveSpells parent, int slot)
            : base(null, null, parent)
        {
            Slot = slot;
            _parentSpellContainer = parent;

            _highlightColor = new Texture2D(Game.GraphicsDevice, 1, 1);
            _highlightColor.SetData(new[] { Color.FromNonPremultiplied(200, 200, 200, 60) });

            _setSize(ICON_AREA_WIDTH, ICON_AREA_HEIGHT);

            OldWorld.IgnoreDialogs(this);
        }
Esempio n. 12
0
        public void SetPlayerAgree(bool isMain, bool agrees)
        {
            short playerID = isMain ? (short)m_main.ID : (m_leftPlayerID == m_main.ID ? m_rightPlayerID : m_leftPlayerID);

            if (playerID == m_leftPlayerID)
            {
                if (agrees && !m_leftAgrees)
                {
                    ((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_ACTION,
                                                      isMain ? EOResourceID.STATUS_LABEL_TRADE_YOU_ACCEPT : EOResourceID.STATUS_LABEL_TRADE_OTHER_ACCEPT);
                }
                else if (!agrees && m_leftAgrees)
                {
                    ((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_ACTION,
                                                      isMain ? EOResourceID.STATUS_LABEL_TRADE_YOU_CANCEL : EOResourceID.STATUS_LABEL_TRADE_OTHER_CANCEL);
                }

                m_leftAgrees            = agrees;
                m_leftPlayerStatus.Text =
                    OldWorld.GetString(agrees ? EOResourceID.DIALOG_TRADE_WORD_AGREE : EOResourceID.DIALOG_TRADE_WORD_TRADING);
            }
            else if (playerID == m_rightPlayerID)
            {
                if (agrees && !m_rightAgrees)
                {
                    ((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_ACTION,
                                                      isMain ? EOResourceID.STATUS_LABEL_TRADE_YOU_ACCEPT : EOResourceID.STATUS_LABEL_TRADE_OTHER_ACCEPT);
                }
                else if (!agrees && m_rightAgrees)
                {
                    ((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_ACTION,
                                                      isMain ? EOResourceID.STATUS_LABEL_TRADE_YOU_CANCEL : EOResourceID.STATUS_LABEL_TRADE_OTHER_CANCEL);
                }

                m_rightAgrees            = agrees;
                m_rightPlayerStatus.Text =
                    OldWorld.GetString(agrees ? EOResourceID.DIALOG_TRADE_WORD_AGREE : EOResourceID.DIALOG_TRADE_WORD_TRADING);
            }
            else
            {
                throw new ArgumentException("Invalid Player ID for trade session!");
            }
        }
        public QuestHistoryDialogListItem(ScrollingListDialog parent, int index = -1)
            : base(parent, ListItemStyle.Small, index)
        {
            m_iconTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 68, true);

            _setSize(427, 16);

            m_primaryText.DrawLocation = new Vector2(m_primaryText.DrawLocation.X + 25, m_primaryText.DrawLocation.Y);
            m_secondaryText            = new XNALabel(new Rectangle(290, (int)m_primaryText.DrawLocation.Y, 1, 1), Constants.FontSize08pt5)
            {
                AutoSize  = true,
                BackColor = m_primaryText.BackColor,
                ForeColor = m_primaryText.ForeColor,
                Text      = OldWorld.GetString(EOResourceID.QUEST_COMPLETED)
            };
            m_secondaryText.SetParent(this);

            _constructorFinished = true;
        }
Esempio n. 14
0
        private ChestDialog(PacketAPI api, byte chestX, byte chestY)
            : base(api)
        {
            CurrentChestX = chestX;
            CurrentChestY = chestY;

            XNAButton cancel = new XNAButton(smallButtonSheet, new Vector2(92, 227), _getSmallButtonOut(SmallButton.Cancel), _getSmallButtonOver(SmallButton.Cancel));

            cancel.OnClick += (sender, e) => Close(cancel, XNADialogResult.Cancel);
            dlgButtons.Add(cancel);
            whichButtons = XNADialogButtons.Cancel;

            bgTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 51);
            _setSize(bgTexture.Width, bgTexture.Height);

            endConstructor(false);
            DrawLocation = new Vector2((Game.GraphicsDevice.PresentationParameters.BackBufferWidth - DrawArea.Width) / 2f, 15);
            cancel.SetParent(this);

            EOGame.Instance.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_ACTION, EOResourceID.STATUS_LABEL_CHEST_YOU_OPENED,
                                               OldWorld.GetString(EOResourceID.STATUS_LABEL_DRAG_AND_DROP_ITEMS));
        }
Esempio n. 15
0
        private KeyLayout m_keyboard = KeyLayout.English; //this is not stored or loaded

        //parent x,y - 102,330
        public OldEOSettingsPanel(XNAPanel parent)
            : base(null, null, parent)
        {
            _setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

            w           = OldWorld.Instance;
            m_leftSide  = new XNALabel[5];
            m_rightSide = new XNALabel[5];

            for (int i = 0; i < m_leftSide.Length; ++i)
            {
                m_leftSide[i] = new XNALabel(new Rectangle(117, 25 + (18 * i), 100, 15), Constants.FontSize08pt5)
                {
                    ForeColor = ColorConstants.LightGrayText
                };
                m_leftSide[i].SetParent(this);
                m_rightSide[i] = new XNALabel(new Rectangle(356, 25 + (18 * i), 100, 15), Constants.FontSize08pt5)
                {
                    ForeColor = ColorConstants.LightGrayText
                };
                m_rightSide[i].SetParent(this);
            }

            _setTextForLanguage();

            m_buttons = new XNAButton[10];
            for (int i = 0; i < m_buttons.Length; ++i)
            {
                m_buttons[i] = new XNAButton(((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27, true),
                                             new Vector2(i < 5 ? 215 : 454, 25 + (18 * (i % 5))),
                                             new Rectangle(0, 0, 19, 15),
                                             new Rectangle(19, 0, 19, 15));

                m_buttons[i].SetParent(this);
                m_buttons[i].OnClick     += _settingChange;
                m_buttons[i].OnMouseOver += (o, e) => EOGame.Instance.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_BUTTON, EOResourceID.STATUS_LABEL_SETTINGS_CLICK_TO_CHANGE);
            }
        }
Esempio n. 16
0
        private void _removeItem(EIFRecord item, int amount)
        {
            if (!EOGame.Instance.Hud.InventoryFits((short)item.ID))
            {
                EOMessageBox.Show(OldWorld.GetString(EOResourceID.STATUS_LABEL_ITEM_PICKUP_NO_SPACE_LEFT),
                                  OldWorld.GetString(EOResourceID.STATUS_LABEL_TYPE_WARNING),
                                  EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                return;
            }

            if (OldWorld.Instance.MainPlayer.ActiveCharacter.Weight + item.Weight * amount > OldWorld.Instance.MainPlayer.ActiveCharacter.MaxWeight)
            {
                EOMessageBox.Show(OldWorld.GetString(EOResourceID.DIALOG_ITS_TOO_HEAVY_WEIGHT),
                                  OldWorld.GetString(EOResourceID.STATUS_LABEL_TYPE_WARNING),
                                  EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                return;
            }

            if (!m_api.LockerTakeItem(X, Y, (short)item.ID))
            {
                EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
            }
        }
Esempio n. 17
0
        public void SetData(List <PartyMember> memberList)
        {
            if (memberList.TrueForAll(_member => _member.IsFullData))
            {
                if (m_members == null || m_members.Count == 0)
                {
                    ((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_INFORMATION, EOResourceID.STATUS_LABEL_PARTY_YOU_JOINED);
                    ((EOGame)Game).Hud.AddChat(ChatTab.System, "", OldWorld.GetString(EOResourceID.STATUS_LABEL_PARTY_YOU_JOINED), ChatIcon.PlayerParty, ChatColor.PM);
                }

                Visible           = true;
                m_numMembers.Text = $"{memberList.Count}";
                m_members         = memberList;

                m_mainIsLeader = m_members.FindIndex(_member => _member.IsLeader && _member.ID == OldWorld.Instance.MainPlayer.ActiveCharacter.ID) >= 0;
                m_scrollBar.UpdateDimensions(memberList.Count);

                m_buttons.Clear();

                foreach (PartyMember member in m_members)
                {
                    _addRemoveButtonForMember(member);
                }
            }
            else
            {
                //update HP only
// ReSharper disable once ForCanBeConvertedToForeach
                for (int i = 0; i < memberList.Count; ++i)
                {
                    int         ndx    = m_members.FindIndex(_member => _member.ID == memberList[i].ID);
                    PartyMember member = m_members[ndx];
                    member.SetPercentHealth(memberList[i].PercentHealth);
                    m_members[ndx] = member;
                }
            }
        }
 private void _eventTrade(object arg1, EventArgs arg2)
 {
     if (OldWorld.Instance.MainPlayer.ActiveCharacter.CurrentMap == OldWorld.Instance.JailMap)
     {
         EOMessageBox.Show(OldWorld.GetString(EOResourceID.JAIL_WARNING_CANNOT_TRADE),
                           OldWorld.GetString(EOResourceID.STATUS_LABEL_TYPE_WARNING),
                           EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
     }
     else
     {
         if (m_lastTradeRequestedTime != null && (DateTime.Now - m_lastTradeRequestedTime.Value).TotalSeconds < Constants.TradeRequestTimeoutSeconds)
         {
             ((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_WARNING, EOResourceID.STATUS_LABEL_TRADE_RECENTLY_REQUESTED);
             return;
         }
         m_lastTradeRequestedTime = DateTime.Now;
         if (!m_api.TradeRequest((short)m_rend.Character.ID))
         {
             ((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
         }
         //todo: is this correct text?
         ((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_ACTION, EOResourceID.STATUS_LABEL_TRADE_REQUESTED_TO_TRADE);
     }
 }
Esempio n. 19
0
        public override void Update(GameTime gameTime)
        {
            if (!Game.IsActive || !Enabled)
            {
                return;
            }

            //check for drag-drop here
            MouseState currentState = Mouse.GetState();

            if (!m_beingDragged && MouseOverPreviously && MouseOver && PreviousMouseState.LeftButton == ButtonState.Pressed && currentState.LeftButton == ButtonState.Pressed)
            {
                //Conditions for starting are the mouse is over, the button is pressed, and no other items are being dragged
                if (((OldEOInventory)parent).NoItemsDragging())
                {
                    //start the drag operation and hide the item label
                    m_beingDragged      = true;
                    m_nameLabel.Visible = false;
                    m_preDragDrawOrder  = DrawOrder;
                    m_preDragParent     = parent;

                    //make sure the offsets are maintained!
                    //required to enable dragging past bounds of the inventory panel
                    m_oldOffX = xOff;
                    m_oldOffY = yOff;
                    SetParent(null);

                    m_alpha   = 128;
                    DrawOrder = 200; //arbitrarily large constant so drawn on top while dragging
                }
            }

            if (m_beingDragged && PreviousMouseState.LeftButton == ButtonState.Pressed &&
                currentState.LeftButton == ButtonState.Pressed)
            {
                //dragging has started. continue dragging until mouse is released, update position based on mouse location
                DrawLocation = new Vector2(currentState.X - (DrawArea.Width / 2), currentState.Y - (DrawArea.Height / 2));
            }
            else if (m_beingDragged && PreviousMouseState.LeftButton == ButtonState.Pressed &&
                     currentState.LeftButton == ButtonState.Released)
            {
                //need to check for: drop on map (drop action)
                //                     drop on button junk/drop
                //                     drop on grid (inventory move action)
                //                     drop on [x] dialog ([x] add action)

                m_alpha = 255;
                SetParent(m_preDragParent);

                if (((OldEOInventory)parent).IsOverDrop() || (OldWorld.Instance.ActiveMapRenderer.MouseOver &&
                                                              ChestDialog.Instance == null && EOPaperdollDialog.Instance == null && LockerDialog.Instance == null &&
                                                              BankAccountDialog.Instance == null && TradeDialog.Instance == null))
                {
                    Point loc = OldWorld.Instance.ActiveMapRenderer.MouseOver ? OldWorld.Instance.ActiveMapRenderer.GridCoords :
                                new Point(OldWorld.Instance.MainPlayer.ActiveCharacter.X, OldWorld.Instance.MainPlayer.ActiveCharacter.Y);

                    //in range if maximum coordinate difference is <= 2 away
                    bool inRange = Math.Abs(Math.Max(OldWorld.Instance.MainPlayer.ActiveCharacter.X - loc.X, OldWorld.Instance.MainPlayer.ActiveCharacter.Y - loc.Y)) <= 2;

                    if (m_itemData.Special == ItemSpecial.Lore)
                    {
                        EOMessageBox.Show(DialogResourceID.ITEM_IS_LORE_ITEM, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    }
                    else if (OldWorld.Instance.JailMap == OldWorld.Instance.MainPlayer.ActiveCharacter.CurrentMap)
                    {
                        EOMessageBox.Show(OldWorld.GetString(EOResourceID.JAIL_WARNING_CANNOT_DROP_ITEMS),
                                          OldWorld.GetString(EOResourceID.STATUS_LABEL_TYPE_WARNING),
                                          EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    }
                    else if (m_inventory.Amount > 1 && inRange)
                    {
                        ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.DropItems,
                                                                        m_inventory.Amount);
                        dlg.DialogClosing += (sender, args) =>
                        {
                            if (args.Result == XNADialogResult.OK)
                            {
                                //note: not sure of the actual limit. 10000 is arbitrary here
                                if (dlg.SelectedAmount > 10000 && m_inventory.ItemID == 1 && !safetyCommentHasBeenShown)
                                {
                                    EOMessageBox.Show(DialogResourceID.DROP_MANY_GOLD_ON_GROUND, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader,
                                                      (o, e) => { safetyCommentHasBeenShown = true; });
                                }
                                else if (!m_api.DropItem(m_inventory.ItemID, dlg.SelectedAmount, (byte)loc.X, (byte)loc.Y))
                                {
                                    ((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
                                }
                            }
                        };
                    }
                    else if (inRange)
                    {
                        if (!m_api.DropItem(m_inventory.ItemID, 1, (byte)loc.X, (byte)loc.Y))
                        {
                            ((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
                        }
                    }
                    else /*if (!inRange)*/
                    {
                        EOGame.Instance.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_WARNING, EOResourceID.STATUS_LABEL_ITEM_DROP_OUT_OF_RANGE);
                    }
                }
                else if (((OldEOInventory)parent).IsOverJunk())
                {
                    if (m_inventory.Amount > 1)
                    {
                        ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.JunkItems,
                                                                        m_inventory.Amount, EOResourceID.DIALOG_TRANSFER_JUNK);
                        dlg.DialogClosing += (sender, args) =>
                        {
                            if (args.Result == XNADialogResult.OK && !m_api.JunkItem(m_inventory.ItemID, dlg.SelectedAmount))
                            {
                                ((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
                            }
                        };
                    }
                    else if (!m_api.JunkItem(m_inventory.ItemID, 1))
                    {
                        ((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
                    }
                }
                else if (ChestDialog.Instance != null && ChestDialog.Instance.MouseOver && ChestDialog.Instance.MouseOverPreviously)
                {
                    if (m_itemData.Special == ItemSpecial.Lore)
                    {
                        EOMessageBox.Show(DialogResourceID.ITEM_IS_LORE_ITEM, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    }
                    else if (m_inventory.Amount > 1)
                    {
                        ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.DropItems, m_inventory.Amount);
                        dlg.DialogClosing += (sender, args) =>
                        {
                            if (args.Result == XNADialogResult.OK &&
                                !m_api.ChestAddItem(ChestDialog.Instance.CurrentChestX, ChestDialog.Instance.CurrentChestY,
                                                    m_inventory.ItemID, dlg.SelectedAmount))
                            {
                                EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                            }
                        };
                    }
                    else
                    {
                        if (!m_api.ChestAddItem(ChestDialog.Instance.CurrentChestX, ChestDialog.Instance.CurrentChestY, m_inventory.ItemID, 1))
                        {
                            EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                        }
                    }
                }
                else if (EOPaperdollDialog.Instance != null && EOPaperdollDialog.Instance.MouseOver && EOPaperdollDialog.Instance.MouseOverPreviously)
                {
                    //equipable items should be equipped
                    //other item types should do nothing
                    switch (m_itemData.Type)
                    {
                    case ItemType.Accessory:
                    case ItemType.Armlet:
                    case ItemType.Armor:
                    case ItemType.Belt:
                    case ItemType.Boots:
                    case ItemType.Bracer:
                    case ItemType.Gloves:
                    case ItemType.Hat:
                    case ItemType.Necklace:
                    case ItemType.Ring:
                    case ItemType.Shield:
                    case ItemType.Weapon:
                        _handleDoubleClick();
                        break;
                    }
                }
                else if (LockerDialog.Instance != null && LockerDialog.Instance.MouseOver && LockerDialog.Instance.MouseOverPreviously)
                {
                    byte x = LockerDialog.Instance.X;
                    byte y = LockerDialog.Instance.Y;
                    if (m_inventory.ItemID == 1)
                    {
                        EOMessageBox.Show(DialogResourceID.LOCKER_DEPOSIT_GOLD_ERROR, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    }
                    else if (m_inventory.Amount > 1)
                    {
                        ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.ShopTransfer, m_inventory.Amount, EOResourceID.DIALOG_TRANSFER_TRANSFER);
                        dlg.DialogClosing += (sender, args) =>
                        {
                            if (args.Result == XNADialogResult.OK)
                            {
                                if (LockerDialog.Instance.GetNewItemAmount(m_inventory.ItemID, dlg.SelectedAmount) > Constants.LockerMaxSingleItemAmount)
                                {
                                    EOMessageBox.Show(DialogResourceID.LOCKER_FULL_SINGLE_ITEM_MAX, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                                }
                                else if (!m_api.LockerAddItem(x, y, m_inventory.ItemID, dlg.SelectedAmount))
                                {
                                    EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                                }
                            }
                        };
                    }
                    else
                    {
                        if (LockerDialog.Instance.GetNewItemAmount(m_inventory.ItemID, 1) > Constants.LockerMaxSingleItemAmount)
                        {
                            EOMessageBox.Show(DialogResourceID.LOCKER_FULL_SINGLE_ITEM_MAX, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                        }
                        else if (!m_api.LockerAddItem(x, y, m_inventory.ItemID, 1))
                        {
                            EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                        }
                    }
                }
                else if (BankAccountDialog.Instance != null && BankAccountDialog.Instance.MouseOver && BankAccountDialog.Instance.MouseOverPreviously && m_inventory.ItemID == 1)
                {
                    if (m_inventory.Amount == 0)
                    {
                        EOMessageBox.Show(DialogResourceID.BANK_ACCOUNT_UNABLE_TO_DEPOSIT, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    }
                    else if (m_inventory.Amount > 1)
                    {
                        ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.BankTransfer,
                                                                        m_inventory.Amount, EOResourceID.DIALOG_TRANSFER_DEPOSIT);
                        dlg.DialogClosing += (o, e) =>
                        {
                            if (e.Result == XNADialogResult.Cancel)
                            {
                                return;
                            }

                            if (!m_api.BankDeposit(dlg.SelectedAmount))
                            {
                                EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                            }
                        };
                    }
                    else
                    {
                        if (!m_api.BankDeposit(1))
                        {
                            EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                        }
                    }
                }
                else if (TradeDialog.Instance != null && TradeDialog.Instance.MouseOver && TradeDialog.Instance.MouseOverPreviously &&
                         !TradeDialog.Instance.MainPlayerAgrees)
                {
                    if (m_itemData.Special == ItemSpecial.Lore)
                    {
                        EOMessageBox.Show(DialogResourceID.ITEM_IS_LORE_ITEM);
                    }
                    else if (m_inventory.Amount > 1)
                    {
                        ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.TradeItems,
                                                                        m_inventory.Amount, EOResourceID.DIALOG_TRANSFER_OFFER);
                        dlg.DialogClosing += (o, e) =>
                        {
                            if (e.Result != XNADialogResult.OK)
                            {
                                return;
                            }

                            if (!m_api.TradeAddItem(m_inventory.ItemID, dlg.SelectedAmount))
                            {
                                TradeDialog.Instance.Close(XNADialogResult.NO_BUTTON_PRESSED);
                                ((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
                            }
                        };
                    }
                    else if (!m_api.TradeAddItem(m_inventory.ItemID, 1))
                    {
                        TradeDialog.Instance.Close(XNADialogResult.NO_BUTTON_PRESSED);
                        ((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
                    }
                }

                //update the location - if it isn't on the grid, the bounds check will set it back to where it used to be originally
                //Item amount will be updated or item will be removed in packet response to the drop operation
                UpdateItemLocation(ItemCurrentSlot());

                //mouse has been released. finish dragging.
                m_beingDragged      = false;
                m_nameLabel.Visible = true;
                DrawOrder           = m_preDragDrawOrder;
            }

            if (!m_beingDragged && PreviousMouseState.LeftButton == ButtonState.Pressed &&
                currentState.LeftButton == ButtonState.Released && MouseOver && MouseOverPreviously)
            {
                Interlocked.Increment(ref m_recentClickCount);
                if (m_recentClickCount == 2)
                {
                    _handleDoubleClick();
                }
            }

            if (!MouseOverPreviously && MouseOver && !m_beingDragged)
            {
                m_nameLabel.Visible = true;
                EOGame.Instance.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_ITEM, m_nameLabel.Text);
            }
            else if (!MouseOver && !m_beingDragged && m_nameLabel != null && m_nameLabel.Visible)
            {
                m_nameLabel.Visible = false;
            }

            base.Update(gameTime); //sets mouseoverpreviously = mouseover, among other things
        }
Esempio n. 20
0
        private void _buySellItem(ShopItem item)
        {
            if (m_state != ShopState.Buying && m_state != ShopState.Selling)
            {
                return;
            }
            bool isBuying = m_state == ShopState.Buying;

            InventoryItem ii  = OldWorld.Instance.MainPlayer.ActiveCharacter.Inventory.Find(x => (isBuying ? x.ItemID == 1 : x.ItemID == item.ID));
            var           rec = OldWorld.Instance.EIF[item.ID];

            if (isBuying)
            {
                if (!EOGame.Instance.Hud.InventoryFits((short)item.ID))
                {
                    EOMessageBox.Show(OldWorld.GetString(EOResourceID.DIALOG_TRANSFER_NOT_ENOUGH_SPACE),
                                      OldWorld.GetString(EOResourceID.STATUS_LABEL_TYPE_WARNING),
                                      EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    return;
                }

                if (rec.Weight + OldWorld.Instance.MainPlayer.ActiveCharacter.Weight >
                    OldWorld.Instance.MainPlayer.ActiveCharacter.MaxWeight)
                {
                    EOMessageBox.Show(OldWorld.GetString(EOResourceID.DIALOG_TRANSFER_NOT_ENOUGH_WEIGHT),
                                      OldWorld.GetString(EOResourceID.STATUS_LABEL_TYPE_WARNING),
                                      EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    return;
                }

                if (ii.Amount < item.Buy)
                {
                    EOMessageBox.Show(DialogResourceID.WARNING_YOU_HAVE_NOT_ENOUGH, " gold.", EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    return;
                }
            }
            else if (ii.Amount == 0)
            {
                return; //can't sell if amount of item is 0
            }
            //special case: no need for prompting if selling an item with count == 1 in inventory
            if (!isBuying && ii.Amount == 1)
            {
                string _message =
                    $"{OldWorld.GetString(EOResourceID.DIALOG_WORD_SELL)} 1 {rec.Name} {OldWorld.GetString(EOResourceID.DIALOG_WORD_FOR)} {item.Sell} gold?";
                EOMessageBox.Show(_message, OldWorld.GetString(EOResourceID.DIALOG_SHOP_SELL_ITEMS), EODialogButtons.OkCancel,
                                  EOMessageBoxStyle.SmallDialogSmallHeader, (oo, ee) =>
                {
                    if (ee.Result == XNADialogResult.OK && !m_api.SellItem((short)item.ID, 1))
                    {
                        EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                    }
                });
            }
            else
            {
                ItemTransferDialog dlg = new ItemTransferDialog(rec.Name, ItemTransferDialog.TransferType.ShopTransfer,
                                                                isBuying ? item.MaxBuy : ii.Amount, isBuying ? EOResourceID.DIALOG_TRANSFER_BUY : EOResourceID.DIALOG_TRANSFER_SELL);
                dlg.DialogClosing += (o, e) =>
                {
                    if (e.Result == XNADialogResult.OK)
                    {
                        string _message =
                            $"{OldWorld.GetString(isBuying ? EOResourceID.DIALOG_WORD_BUY : EOResourceID.DIALOG_WORD_SELL)} {dlg.SelectedAmount} {rec.Name} {OldWorld.GetString(EOResourceID.DIALOG_WORD_FOR)} {(isBuying ? item.Buy : item.Sell)*dlg.SelectedAmount} gold?";

                        EOMessageBox.Show(_message,
                                          OldWorld.GetString(isBuying ? EOResourceID.DIALOG_SHOP_BUY_ITEMS : EOResourceID.DIALOG_SHOP_SELL_ITEMS),
                                          EODialogButtons.OkCancel, EOMessageBoxStyle.SmallDialogSmallHeader, (oo, ee) =>
                        {
                            if (ee.Result == XNADialogResult.OK)
                            {
                                //only actually do the buy/sell if the user then clicks "OK" in the second prompt
                                if (isBuying && !m_api.BuyItem((short)item.ID, dlg.SelectedAmount) ||
                                    !isBuying && !m_api.SellItem((short)item.ID, dlg.SelectedAmount))
                                {
                                    EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                                }
                            }
                        });
                    }
                };
            }
        }
Esempio n. 21
0
        private void _setState(ShopState newState)
        {
            ShopState old = m_state;

            if (old == newState)
            {
                return;
            }

            int buyNumInt  = m_tradeItems.FindAll(x => x.Buy > 0).Count;
            int sellNumInt = m_tradeItems.FindAll(x => OldWorld.Instance.MainPlayer.ActiveCharacter.Inventory.FindIndex(item => item.ItemID == x.ID) >= 0 && x.Sell > 0).Count;

            if (newState == ShopState.Buying && buyNumInt <= 0)
            {
                EOMessageBox.Show(DialogResourceID.SHOP_NOTHING_IS_FOR_SALE, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                return;
            }

            if (newState == ShopState.Selling && sellNumInt <= 0)
            {
                EOMessageBox.Show(DialogResourceID.SHOP_NOT_BUYING_YOUR_ITEMS, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                return;
            }

            ClearItemList();
            switch (newState)
            {
            case ShopState.Initial:
            {
                string buyNum =
                    $"{m_tradeItems.FindAll(x => x.Buy > 0).Count} {OldWorld.GetString(EOResourceID.DIALOG_SHOP_ITEMS_IN_STORE)}";
                string sellNum  = $"{sellNumInt} {OldWorld.GetString(EOResourceID.DIALOG_SHOP_ITEMS_ACCEPTED)}";
                string craftNum =
                    $"{m_craftItems.Count} {OldWorld.GetString(EOResourceID.DIALOG_SHOP_ITEMS_ACCEPTED)}";

                ListDialogItem buy = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large, 0)
                {
                    Text        = OldWorld.GetString(EOResourceID.DIALOG_SHOP_BUY_ITEMS),
                    SubText     = buyNum,
                    IconGraphic = BuyIcon,
                    OffsetY     = 45
                };
                buy.OnLeftClick       += (o, e) => _setState(ShopState.Buying);
                buy.OnRightClick      += (o, e) => _setState(ShopState.Buying);
                buy.ShowItemBackGround = false;
                AddItemToList(buy, false);
                ListDialogItem sell = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large, 1)
                {
                    Text        = OldWorld.GetString(EOResourceID.DIALOG_SHOP_SELL_ITEMS),
                    SubText     = sellNum,
                    IconGraphic = SellIcon,
                    OffsetY     = 45
                };
                sell.OnLeftClick       += (o, e) => _setState(ShopState.Selling);
                sell.OnRightClick      += (o, e) => _setState(ShopState.Selling);
                sell.ShowItemBackGround = false;
                AddItemToList(sell, false);
                if (m_craftItems.Count > 0)
                {
                    ListDialogItem craft = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large, 2)
                    {
                        Text        = OldWorld.GetString(EOResourceID.DIALOG_SHOP_CRAFT_ITEMS),
                        SubText     = craftNum,
                        IconGraphic = CraftIcon,
                        OffsetY     = 45
                    };
                    craft.OnLeftClick       += (o, e) => _setState(ShopState.Crafting);
                    craft.OnRightClick      += (o, e) => _setState(ShopState.Crafting);
                    craft.ShowItemBackGround = false;
                    AddItemToList(craft, false);
                }
                _setButtons(ScrollingListDialogButtons.Cancel);
            }
            break;

            case ShopState.Buying:
            case ShopState.Selling:
            {
                //re-use the logic for Buying/Selling: it is almost identical
                bool buying = newState == ShopState.Buying;

                List <ListDialogItem> itemList = new List <ListDialogItem>();
                foreach (ShopItem si in m_tradeItems)
                {
                    if (si.ID <= 0 || (buying && si.Buy <= 0) ||
                        (!buying && (si.Sell <= 0 || OldWorld.Instance.MainPlayer.ActiveCharacter.Inventory.FindIndex(inv => inv.ItemID == si.ID) < 0)))
                    {
                        continue;
                    }

                    ShopItem localItem = si;
                    var      rec       = OldWorld.Instance.EIF[si.ID];
                    string   secondary = string.Format("{2}: {0} {1}", buying ? si.Buy : si.Sell,
                                                       rec.Type == ItemType.Armor ? "(" + (rec.Gender == 0 ? OldWorld.GetString(EOResourceID.FEMALE) : OldWorld.GetString(EOResourceID.MALE)) + ")" : "",
                                                       OldWorld.GetString(EOResourceID.DIALOG_SHOP_PRICE));

                    ListDialogItem nextItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large)
                    {
                        Text        = rec.Name,
                        SubText     = secondary,
                        IconGraphic = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.Items, 2 * rec.Graphic - 1, true),
                        OffsetY     = 45
                    };
                    nextItem.OnLeftClick  += (o, e) => _buySellItem(localItem);
                    nextItem.OnRightClick += (o, e) => _buySellItem(localItem);

                    itemList.Add(nextItem);
                }
                SetItemList(itemList);
                _setButtons(ScrollingListDialogButtons.BackCancel);
            }
            break;

            case ShopState.Crafting:
            {
                List <ListDialogItem> itemList = new List <ListDialogItem>(m_craftItems.Count);
                foreach (CraftItem ci in m_craftItems)
                {
                    if (ci.Ingredients.Count <= 0)
                    {
                        continue;
                    }

                    CraftItem localItem = ci;
                    var       rec       = OldWorld.Instance.EIF[ci.ID];
                    string    secondary = string.Format("{2}: {0} {1}", ci.Ingredients.Count,
                                                        rec.Type == ItemType.Armor ? "(" + (rec.Gender == 0 ? OldWorld.GetString(EOResourceID.FEMALE) : OldWorld.GetString(EOResourceID.MALE)) + ")" : "",
                                                        OldWorld.GetString(EOResourceID.DIALOG_SHOP_CRAFT_INGREDIENTS));

                    ListDialogItem nextItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large)
                    {
                        Text        = rec.Name,
                        SubText     = secondary,
                        IconGraphic = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.Items, 2 * rec.Graphic - 1, true),
                        OffsetY     = 45
                    };
                    nextItem.OnLeftClick  += (o, e) => _craftItem(localItem);
                    nextItem.OnRightClick += (o, e) => _craftItem(localItem);

                    itemList.Add(nextItem);
                }
                SetItemList(itemList);
                _setButtons(ScrollingListDialogButtons.BackCancel);
            }
            break;
            }

            m_state = newState;
        }
Esempio n. 22
0
        public void InheritanceSparrow()
        {
            OldWorld TestSparrow = new OldWorld();

            Assert.True(TestSparrow is Sparrow);
        }
Esempio n. 23
0
        public void InterfaceSparrowRatingTest()
        {
            OldWorld TestSparrow = new OldWorld();

            Assert.Equal(6, TestSparrow.PetRating());
        }
Esempio n. 24
0
        public void OldWorldSparrowFlightTest()
        {
            OldWorld TestSparrow = new OldWorld();

            Assert.Equal(28, TestSparrow.FlightSpeed);
        }
Esempio n. 25
0
        public void OldWorldSparrowLifeExpectancyTest()
        {
            OldWorld TestSparrow = new OldWorld();

            Assert.InRange(TestSparrow.ExpectedLifeSpan(), 1, 5);
        }
Esempio n. 26
0
        public void OldWorldSparrowCoatTest()
        {
            OldWorld TestSparrow = new OldWorld();

            Assert.Equal("Feathers", TestSparrow.Coating);
        }
Esempio n. 27
0
        /// <summary>
        /// instatiates every derived class
        /// and displays all of its polymorphic properties and methods
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            //For Domesticated Dog
            Domesticated Fluffy = new Domesticated("Fluffy", 2);
            Domesticated Annie  = new Domesticated("Annie", 5);

            Domesticated.WhatAnimal();
            Console.WriteLine($"{Fluffy.Name} is {Fluffy.Age} years old");
            Console.WriteLine($"{Fluffy.Name} is expected to live for {Fluffy.ExpectedLifeSpan()} years");
            Console.WriteLine($"{Fluffy.Name} has {Fluffy.Coating}");
            Console.WriteLine(Fluffy.MakeSound());
            Fluffy.Action();
            Fluffy.ThisAnimalSwims();
            Fluffy.ThisAnimalCanBePet();
            Fluffy.SwimSpeed();
            Console.WriteLine();
            //For different instatiating of Domesticated
            Console.WriteLine($"{Annie.Name} is {Annie.Age} years old");
            Console.WriteLine($"{Annie.Name} is expected to live for {Annie.ExpectedLifeSpan()} years");
            Console.WriteLine($"{Annie.Name} has {Annie.Coating}");
            Console.WriteLine(Annie.MakeSound());
            Annie.Action();
            Console.WriteLine();
            //For HouseCat Cat
            HouseCat Precious = new HouseCat("Precious", 7);

            HouseCat.WhatAnimal();
            Console.WriteLine($"{Precious.Name} is {Precious.Age} years old");
            Console.WriteLine($"{Precious.Name} has {Precious.Coating}");
            Console.WriteLine($"{Precious.Name} is expected to live for {Precious.ExpectedLifeSpan()} years");
            Console.WriteLine(Precious.MakeSound());
            Precious.Action();
            Precious.ThisAnimalCanBePet();
            Console.WriteLine();
            //For Japanese Puffer
            Japanese KnawKnaw = new Japanese("KnawKnaw", 5);

            Japanese.WhatAnimal();
            Console.WriteLine($"{KnawKnaw.Name} is {KnawKnaw.Age} years old");
            Console.WriteLine($"{KnawKnaw.Name} has {KnawKnaw.Coating}");
            Console.WriteLine($"{KnawKnaw.Name} is expected to live for {KnawKnaw.ExpectedLifeSpan()} years");
            Console.WriteLine(KnawKnaw.MakeSound());
            Console.WriteLine(KnawKnaw.WillItPoisonYou(KnawKnaw.Poison));
            KnawKnaw.SwimSpeed();
            KnawKnaw.ThisAnimalSwims();
            Console.WriteLine();
            //For Brazilian Pirahna
            Brazilian CoCo = new Brazilian("CoCo", 4);

            Brazilian.WhatAnimal();
            Console.WriteLine($"{CoCo.Name} is {CoCo.Age} years old");
            Console.WriteLine($"{CoCo.Name} has {CoCo.Coating}");
            Console.WriteLine($"{CoCo.Name} is expected to live for {CoCo.ExpectedLifeSpan()} years");
            Console.WriteLine(CoCo.MakeSound());
            Console.WriteLine(CoCo.WillItPoisonYou(CoCo.Poison));
            CoCo.PetRating();
            CoCo.ThisAnimalCanBePet();
            CoCo.SwimSpeed();
            CoCo.ThisAnimalSwims();
            Console.WriteLine();
            ////For African CrownEagle
            African America = new African("America", 8, 320);

            African.WhatAnimal();
            Console.WriteLine($"{America.Name} is {America.Age} years old");
            Console.WriteLine($"{America.Name} has {America.Coating}");
            Console.WriteLine($"{America.Name} is expected to live for {America.ExpectedLifeSpan()} years");
            Console.WriteLine($"{America.Name}'s top flight speed is {America.FlightSpeed}");
            Console.WriteLine(America.MakeSound());
            Console.WriteLine();
            //For OldWorld Sparrow
            OldWorld Serene = new OldWorld("Sparrow", 8);

            OldWorld.WhatAnimal();
            Console.WriteLine($"{Serene.Name} is {Serene.Age} years old");
            Console.WriteLine($"{Serene.Name} has {Serene.Coating}");
            Console.WriteLine($"{Serene.Name} is expected to live for {Serene.ExpectedLifeSpan()} years");
            Console.WriteLine($"{Serene.Name}'s top flight speed is {Serene.FlightSpeed}");
            Console.WriteLine(Serene.MakeSound());
            Serene.PetRating();
            Serene.ThisAnimalCanBePet();
            Console.WriteLine();

            Console.WriteLine(typeof(Japanese).GetInterface("ICanSwim"));

            Console.ReadKey();
        }
Esempio n. 28
0
        private SessionExpDialog()
            : base((PacketAPI)null)
        {
            bgTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 61);
            _setSize(bgTexture.Width, bgTexture.Height);

            m_icons  = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 68, true);
            m_signal = new Rectangle(0, 15, 15, 15);
            m_icon   = new Rectangle(0, 0, 15, 15);

            XNAButton okButton = new XNAButton(smallButtonSheet, new Vector2(98, 214), _getSmallButtonOut(SmallButton.Ok), _getSmallButtonOver(SmallButton.Ok));

            okButton.OnClick += (sender, args) => Close(okButton, XNADialogResult.OK);
            okButton.SetParent(this);

            XNALabel title = new XNALabel(new Rectangle(20, 17, 1, 1), Constants.FontSize08pt5)
            {
                AutoSize  = false,
                Text      = OldWorld.GetString(EOResourceID.DIALOG_TITLE_PERFORMANCE),
                ForeColor = ColorConstants.LightGrayText
            };

            title.SetParent(this);

            XNALabel[] leftSide = new XNALabel[8], rightSide = new XNALabel[8];
            for (int i = 48; i <= 160; i += 16)
            {
                leftSide[(i - 48) / 16] = new XNALabel(new Rectangle(38, i, 1, 1), Constants.FontSize08pt5)
                {
                    AutoSize  = false,
                    ForeColor = ColorConstants.LightGrayText
                };
                leftSide[(i - 48) / 16].SetParent(this);
                rightSide[(i - 48) / 16] = new XNALabel(new Rectangle(158, i, 1, 1), Constants.FontSize08pt5)
                {
                    AutoSize  = false,
                    ForeColor = ColorConstants.LightGrayText
                };
                rightSide[(i - 48) / 16].SetParent(this);
            }

            leftSide[0].Text = OldWorld.GetString(EOResourceID.DIALOG_PERFORMANCE_TOTALEXP);
            leftSide[1].Text = OldWorld.GetString(EOResourceID.DIALOG_PERFORMANCE_NEXT_LEVEL);
            leftSide[2].Text = OldWorld.GetString(EOResourceID.DIALOG_PERFORMANCE_EXP_NEEDED);
            leftSide[3].Text = OldWorld.GetString(EOResourceID.DIALOG_PERFORMANCE_TODAY_EXP);
            leftSide[4].Text = OldWorld.GetString(EOResourceID.DIALOG_PERFORMANCE_TOTAL_AVG);
            leftSide[5].Text = OldWorld.GetString(EOResourceID.DIALOG_PERFORMANCE_TODAY_AVG);
            leftSide[6].Text = OldWorld.GetString(EOResourceID.DIALOG_PERFORMANCE_BEST_KILL);
            leftSide[7].Text = OldWorld.GetString(EOResourceID.DIALOG_PERFORMANCE_LAST_KILL);
            OldCharacter c = OldWorld.Instance.MainPlayer.ActiveCharacter;

            rightSide[0].Text = $"{c.Stats.Experience}";
            rightSide[1].Text = $"{OldWorld.Instance.exp_table[c.Stats.Level + 1]}";
            rightSide[2].Text = $"{OldWorld.Instance.exp_table[c.Stats.Level + 1] - c.Stats.Experience}";
            rightSide[3].Text = $"{c.TodayExp}";
            rightSide[4].Text = $"{(int) (c.Stats.Experience/(c.Stats.Usage/60.0))}";
            int sessionTime = (int)(DateTime.Now - EOGame.Instance.Hud.SessionStartTime).TotalMinutes;

            rightSide[5].Text = $"{(sessionTime > 0 ? (c.TodayExp/sessionTime) : 0)}";
            rightSide[6].Text = $"{c.TodayBestKill}";
            rightSide[7].Text = $"{c.TodayLastKill}";

            Array.ForEach(leftSide, lbl => lbl.ResizeBasedOnText());
            Array.ForEach(rightSide, lbl => lbl.ResizeBasedOnText());

            Center(Game.GraphicsDevice);
            DrawLocation = new Vector2(DrawLocation.X, 15);
            endConstructor(false);
        }
Esempio n. 29
0
        public void SetLockerData(List <InventoryItem> lockerItems)
        {
            ClearItemList();
            items = lockerItems;
            Title = string.Format(TITLE_FMT, lockerItems.Count);

            List <ListDialogItem> listItems = new List <ListDialogItem>();

            foreach (InventoryItem item in lockerItems)
            {
                var            rec     = OldWorld.Instance.EIF[item.ItemID];
                int            amount  = item.Amount;
                ListDialogItem newItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large)
                {
                    Text    = rec.Name,
                    SubText =
                        $"x{item.Amount}  {(rec.Type == ItemType.Armor ? "(" + (rec.Gender == 0 ? OldWorld.GetString(EOResourceID.FEMALE) : OldWorld.GetString(EOResourceID.MALE)) + ")" : "")}",
                    IconGraphic = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.Items, 2 * rec.Graphic - 1, true),
                    OffsetY     = 45
                };
                newItem.OnRightClick += (o, e) => _removeItem(rec, amount);

                listItems.Add(newItem);
            }

            SetItemList(listItems);
        }
Esempio n. 30
0
        private BankAccountDialog(PacketAPI api)
            : base(api)
        {
            //this uses EODialogListItems but does not inherit from ListDialog since it is a different size
            //offsety 50
            bgTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 53);
            _setSize(bgTexture.Width, bgTexture.Height);

            m_accountBalance = new XNALabel(new Rectangle(129, 20, 121, 16), Constants.FontSize08pt5)
            {
                ForeColor = ColorConstants.LightGrayText,
                Text      = "",
                TextAlign = LabelAlignment.MiddleRight,
                AutoSize  = false
            };
            m_accountBalance.SetParent(this);

            XNAButton cancel = new XNAButton(smallButtonSheet, new Vector2(92, 191), _getSmallButtonOut(SmallButton.Cancel), _getSmallButtonOver(SmallButton.Cancel));

            cancel.SetParent(this);
            cancel.OnClick += (o, e) => Close(cancel, XNADialogResult.Cancel);

            ListDialogItem deposit = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large, 0)
            {
                Text    = OldWorld.GetString(EOResourceID.DIALOG_BANK_DEPOSIT),
                SubText =
                    $"{OldWorld.GetString(EOResourceID.DIALOG_BANK_TRANSFER)} gold {OldWorld.GetString(EOResourceID.DIALOG_BANK_TO_ACCOUNT)}",
                IconGraphic        = _getDlgIcon(ListIcon.BankDeposit),
                OffsetY            = 55,
                ShowItemBackGround = false
            };

            deposit.OnLeftClick  += (o, e) => _deposit();
            deposit.OnRightClick += (o, e) => _deposit();
            ListDialogItem withdraw = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large, 1)
            {
                Text    = OldWorld.GetString(EOResourceID.DIALOG_BANK_WITHDRAW),
                SubText =
                    $"{OldWorld.GetString(EOResourceID.DIALOG_BANK_TAKE)} gold {OldWorld.GetString(EOResourceID.DIALOG_BANK_FROM_ACCOUNT)}",
                IconGraphic        = _getDlgIcon(ListIcon.BankWithdraw),
                OffsetY            = 55,
                ShowItemBackGround = false
            };

            withdraw.OnLeftClick  += (o, e) => _withdraw();
            withdraw.OnRightClick += (o, e) => _withdraw();
            ListDialogItem upgrade = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large, 2)
            {
                Text               = OldWorld.GetString(EOResourceID.DIALOG_BANK_LOCKER_UPGRADE),
                SubText            = OldWorld.GetString(EOResourceID.DIALOG_BANK_MORE_SPACE),
                IconGraphic        = _getDlgIcon(ListIcon.BankLockerUpgrade),
                OffsetY            = 55,
                ShowItemBackGround = false
            };

            upgrade.OnLeftClick  += (o, e) => _upgrade();
            upgrade.OnRightClick += (o, e) => _upgrade();

            DialogClosing += (o, e) => { Instance = null; };

            Center(Game.GraphicsDevice);
            DrawLocation = new Vector2(DrawLocation.X, 50);
            endConstructor(false);
        }