public PlayerInformation()
    {
		NakedArmorInventory = new Inventory();
        MainInventory = new Inventory();
		ArmoryInventory = new Inventory();
		jukeBox = new Jukebox();
		playerShopInventory = new Inventory();
        Equip = new Equipment();
		questLog = new QuestLog();
		profile = new PlayerProfile();
		playerData = new ParseObject("PlayerData");
		parseObjectID = " ";
		PlayerName = " ";
	}
Example #2
0
        public Player(string sprite, GameClient client, UserHero userHero)
            : base(sprite)
        {
            Client = client;
            Backpack = new ItemStorage();
            Bank = new ItemStorage();

            // Allow extraction of the quest information
            QuestLog = new QuestLog(userHero.QuestInfo);

            using (var context = new GameDatabaseContext())
            {
                // Add the skills this player knows
                foreach (var skillEntry in userHero.Skills)
                {
                    var skillTemplate = context.SkillTemplates.First(x => x.Id == skillEntry.SkillId);
                    var skill = new Skill(skillTemplate);
                    Skills.Add(skill);
                }

                // Add the inventory stuff...
                foreach (var inventoryItem in userHero.Inventory)
                {
                    var itemTemplate = context.ItemTemplates.First(x => x.Id == inventoryItem.ItemId);
                    var item = ItemFactory.CreateItem(itemTemplate);
                    Backpack.TryAddItemAt(item, inventoryItem.ItemAmount, inventoryItem.SlotId);
                }

                foreach (var eq in userHero.Equipment)
                {
                    var itemTemplate = context.ItemTemplates.First(x => x.Id == eq.ItemId);
                    var equipment = ItemFactory.CreateItem(itemTemplate) as Equipment;
                    Equipment[(int)equipment.Slot] = equipment;
                }

                UserId = userHero.UserHeroId;
                Experience = userHero.Experience;
                Level = userHero.Level;

                Backpack.StorageChanged += BackpackOnStorageChanged;
                QuestLog.QuestAccepted += QuestLogOnQuestAccepted;
            }

            // Store the user hero internally
            _hero = userHero;
        }
 public ServerSendQuestListPacket(QuestLog questLog)
     : this()
 {
     QuestLog = questLog;
 }
Example #4
0
    // Use this for initialization
    void Start()
    {
        source = GetComponent<AudioSource>();

        pointer = 0;
        q_i = 0;
        q_l = 0;
        q_log = new List<string>();

        gameManager = GameManager.instance;

        this.tag = "Menu";

        instance = this;

        LocationTime();
        HideDescription();
        Log();

        DrawSelect();
    }
        public override int GetHashCode()
        {
            int hash = 1;

            if (typeCase_ == TypeOneofCase.Profile)
            {
                hash ^= Profile.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.VaultItem)
            {
                hash ^= VaultItem.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.CollectionItem)
            {
                hash ^= CollectionItem.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.CollectionFamily)
            {
                hash ^= CollectionFamily.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Walkbox)
            {
                hash ^= Walkbox.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.PlayerFlags)
            {
                hash ^= PlayerFlags.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Portkey)
            {
                hash ^= Portkey.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.PlayerActiveBuffList)
            {
                hash ^= PlayerActiveBuffList.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.CollectionPage)
            {
                hash ^= CollectionPage.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.ProfessionsProgress)
            {
                hash ^= ProfessionsProgress.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.VaultCapacity)
            {
                hash ^= VaultCapacity.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Cauldron)
            {
                hash ^= Cauldron.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.EscrowedRewards)
            {
                hash ^= EscrowedRewards.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.ProfessionsProgressV3)
            {
                hash ^= ProfessionsProgressV3.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.QuestLog)
            {
                hash ^= QuestLog.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Achievement)
            {
                hash ^= Achievement.GetHashCode();
            }
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #6
0
        private void Export()
        {
            QuestLog.Log("[Export Handler]: Itemizing Items...");
            foreach (Item item in ImportHandler.imports.items)
            {
                questingItems[item] = GUID.Parse(item.guid);
            }

            QuestLog.Log("[Export Handler]: Done Itemizing Items...");
            QuestLog.Log("[Export Handler]: Itemizing Recipes...");

            foreach (Recipe item in ImportHandler.imports.recipes)
            {
                questingRecipes[item] = GUID.Parse(item.itemID);
            }

            QuestLog.Log("[Export Handler]: Done Itemizing Recipes...");
            QuestLog.Log("[Export Handler]: Itemizing Modifiers...");

            foreach (Modifier item in ImportHandler.imports.modifiers)
            {
                questingModifiers[item] = item.modification_type;
            }

            QuestLog.Log("[Export Handler]: Done Itemizing Modifiers...");
            QuestLog.Log("[Export Handler]: Itemizing Categories...");

            foreach (Category item in ImportHandler.imports.categories)
            {
                questingCategories[item] = GUID.Parse(item.guid);
            }

            QuestLog.Log("[Export Handler]: Done Itemizing Categories...");
            QuestLog.Log("[Export Handler]: Itemizing Deposits...");

            foreach (Deposit item in ImportHandler.imports.deposits)
            {
                questingDeposits[item] = item.replaced_item;
            }

            QuestLog.Log("[Export Handler]: Done Itemizing Deposits...");
            QuestLog.Log("[Export Handler]: Itemizing Modules...");

            foreach (Module item in ImportHandler.imports.modules)
            {
                questingModules[item] = GUID.Parse(item.guid);
            }

            QuestLog.Log("[Export Handler]: Done Itemizing Modules...");
            QuestLog.Log("[Export Handler]: Itemizing Stations...");

            foreach (Station item in ImportHandler.imports.stations)
            {
                questingStations[item] = GUID.Parse(item.guid);
            }

            QuestLog.Log("[Export Handler]: Done Itemizing Stations...");
            QuestLog.Log("[Export Handler]: Itemizing Schematics...");

            foreach (Schematic item in ImportHandler.imports.schematics)
            {
                questingSchematics[item] = item.id;
            }

            QuestLog.Log("[Export Handler]: Done Itemizing Schematics...");
        }
Example #7
0
 protected void addToLog(QuestLog log)
 {
     log.addQuest(this);
     this.log = log;
 }
Example #8
0
    // Use this for initialization
    void Start()
    {
        gameManager = GameManager.instance;
        quest_log = QuestLog.instance;
        gameMenu = Menu.Instance;
        bagSound = Resources.Load<AudioClip>("Zipper1");
        logSound = Resources.Load<AudioClip>("MemoryLog");
        logSoundClose = Resources.Load<AudioClip>("MemoryLogReverse");
        source = gameObject.GetComponent<AudioSource>();
        //gameMenu = FindObjectOfType(typeof(Menu)) as Menu;
        //quest_log = QuestLog.Instance;
        player = FindObjectOfType(typeof(Player)) as Player;
        ////show_button = gameMenu.In_Mode();
        //inventory_texture = Resources.Load("Bag") as Texture2D;
        //inventory_content.inventory_texture = inventory_texture;
        if (startTime != 0)
        {
            gameManager.SetTime(GameManager.TimeType.SET, startTime);
        }

        transform.FindChild("QuestBook").gameObject.SetActive(false);
        transform.FindChild("Inventory").gameObject.SetActive(false);
    }
        //public static void Runtime()
        //{
        //    foreach (var obj in ExportHandler.questingSchematics)
        //    {
        //        QuestLog.Log(obj.Key.name);
        //    }
        //    QuestLog.Log("[Questing Update | Main]: Runtime Activated");
        //}

        public override void Unload()
        {
            UnityEngine.Debug.Log("[Questing Update | Main]: Questing Update unloaded");
            QuestLog.Log("[Questing Update | Main]: Game Finished, Closing...");
        }
Example #10
0
        public override int Use()
        {
            int used = base.Use();

            if (used < 0)
            {
                return(used);
            }

            var dialogueController = FindObjectOfType <DialogueSystemController>();

            if (dialogueController == null)
            {
                Debug.LogError("Couldn't find DialogueSystemController; Can't activate quest!");
                return(-2);
            }

            var item = dialogueController.DatabaseManager.MasterDatabase.items.FirstOrDefault(o => o.id == _dialogueSystemQuestID);

            if (item == null)
            {
                Debug.LogError("Couldn't find dialogue quest with ID " + _dialogueSystemQuestID);
                return(-2);
            }

            if (item.IsItem)
            {
                Debug.LogError("Dialogue quest with ID " + _dialogueSystemQuestID + " is an item, not a quest");
                return(-2);
            }

            if (QuestLog.IsQuestActive(item.TypeID))
            {
                DialogueManager.ShowAlert(string.Format(questAlreadyActiveMessage, item.TypeID));
                return(-2);
            }

            if (QuestLog.IsQuestDone(item.TypeID) || QuestLog.IsQuestFailed(item.TypeID) || QuestLog.IsQuestAbandoned(item.TypeID))
            {
                if (canUseAfterQuestAlreadyCompleted == false)
                {
                    DialogueManager.ShowAlert(string.Format(questAlreadyUsedMessage, item.TypeID));
                    return(-2);
                }
            }


            currentStackSize--; // Remove 1

            QuestLog.StartQuest(item.TypeID);
            QuestLog.AddQuestStateObserver(item.TypeID, LuaWatchFrequency.EveryDialogueEntry, QuestChangedHandler);

            if (string.IsNullOrEmpty(acceptMessage) == false)
            {
                DialogueManager.ShowAlert(string.Format(acceptMessage, item.TypeID));
            }


            NotifyItemUsed(1, true);
            AudioManager.AudioPlayOneShot(audioClipWhenUsed);

            return(1); // 1 item used
        }
Example #11
0
        public async override Task OnPrimaryWorkerDoWork()
        {
            //IsAutoBuyEnergyFromGold
            if (Account.Config.BuyEnergyMode.HasFlag(BuyEnergyMode.BuyForGold) && BuyEnergyFromGold.CanExecute)
            {
                await BuyEnergyFromGold.TryExecuteAsync();
            }

            // IsAutoBuyEnergyFromPremium
            if (Account.Config.BuyEnergyMode.HasFlag(BuyEnergyMode.BuyForPremium) && BuyEnergyFromPremium.CanExecute)
            {
                await BuyEnergyFromPremium.TryExecuteAsync();
            }

            // IsAutoQuest
            if (Account.Config.IsAutoQuest && StartBestQuest.CanExecute)
            {
                //Enough Energie?
                var quests = Account.Quests.Where(q => q.energy_cost <= Account.Character.quest_energy);

                //QuestMode
                switch (Account.Config.QuestMode)
                {
                case QuestMode.MostGold:
                    quests = quests.OrderBy(q => q.CurrencyPerEnergy);
                    break;

                case QuestMode.MostXP:
                    quests = quests.OrderBy(q => q.XPPerEnergy);
                    break;

                case QuestMode.Balanced:
                    quests = quests.OrderBy(q => q.XPCurrencyPerEneryAverage);
                    break;
                }

                //Quest Difficulty
                switch (Account.Config.QuestDifficulty)
                {
                case FightQuestDifficulty.Easy:
                    quests = quests.SkipWhile(q => q.fight_difficulty > FightQuestDifficulty.Easy);
                    break;

                case FightQuestDifficulty.Medium:
                    quests = quests.SkipWhile(q => q.fight_difficulty > FightQuestDifficulty.Medium);
                    break;

                case FightQuestDifficulty.Hard:
                    quests = quests.SkipWhile(q => q.fight_difficulty > FightQuestDifficulty.Hard);
                    break;
                }

                //Premium Or Statpoint Quest
                var PremiumOrStatpoint = quests.Where(q => q.GetItem != null)?.OrderByDescending(q => q.GetItem.GearScoreDiffToEquiped)?.FirstOrDefault() ??
                                         quests.FirstOrDefault(q => q.GetRewards.premium > 0) ?? quests.FirstOrDefault(q => q.GetRewards.statPoints > 0);

                var quest = PremiumOrStatpoint ?? quests.FirstOrDefault();
                if (quest != null)
                {
                    QuestLog.Add(new Tuple <DateTime, Quest>(DateTime.Now, quest));
                    await StartQuest.TryExecuteAsync(quest);

                    // Account.Log.Add($"[Quest] START: ID:{quest.id} Duration:{quest.duration / 60}");
                }
            }
        }
Example #12
0
 void closeButton_Click(object sender, EventArgs e)
 {
     Game1.state = GameState.Game;
     questLog    = null;
 }
Example #13
0
 public void SetQuestLog(QuestLog questLog)
 {
     this.questLog = questLog;
     RefreshQuests();
 }
Example #14
0
        /// <summary>
        /// loads a save file
        /// </summary>
        private void LoadSave()
        {
            Console.WriteLine(saveLoc);
            Stream       inStream = null;
            BinaryReader input    = null;

            try
            {
                //open the file for reading
                inStream = File.OpenRead(saveLoc);
                input    = new BinaryReader(inStream);

                //red the file
                string world = input.ReadString();
                Console.WriteLine("World: " + world);
                int pX = input.ReadInt32();
                int pY = input.ReadInt32();
                Console.WriteLine("X, Y: " + pX + ", " + pY);
                int pHealth = input.ReadInt32();
                Console.WriteLine("Health: " + pHealth);
                int pCash = input.ReadInt32();
                Console.WriteLine("Cash: " + pCash);
                int pQuestPoints = input.ReadInt32();
                Console.WriteLine("QuestPoints: " + pQuestPoints);

                //read the quests
                int numQuests = input.ReadInt32();
                Console.WriteLine("Num quests: " + numQuests);
                object[,] quests = new object[numQuests, 2];
                for (int i = 0; i < numQuests; i++)
                {
                    quests[i, 0] = input.ReadString();
                    Console.WriteLine("\tName: " + quests[i, 0]);
                    quests[i, 1] = input.ReadInt32();
                    Console.WriteLine("\tStatus: " + quests[i, 1]);
                }

                //read the inventory
                int numItems = input.ReadInt32();
                Console.WriteLine("Num Items: " + numItems);
                string[] items = new string[numItems];
                for (int i = 0; i < numItems; i++)
                {
                    items[i] = input.ReadString();
                    Console.WriteLine("\t" + items[i]);
                }

                int activeItem = input.ReadInt32();
                Console.WriteLine("Active Weapon: " + activeItem);

                //make the world
                if (MainGame.worldManager.worlds.ContainsKey(world))
                {
                    MainGame.worldManager.worlds[world] = LoadWorld(world);
                }
                else
                {
                    MainGame.worldManager.worlds.Add(world, LoadWorld(world));
                }

                //set the player in the world
                Player player = new Player(
                    new FloatRectangle(pX, pY, 32, 32),
                    Sprites.spritesDictionary["player"]
                    );
                player.Cash        = pCash;
                player.health      = pHealth;
                player.QuestPoints = pQuestPoints;

                MainGame.worldManager.CurrentWorld.manager.AddEntity(player);
                Game1.Instance.collisionManager.SwitchWorld();

                //load all of the quests in the quest file
                LoadQuests(MainGame.worldManager.worldQuests);

                //load the quest status
                string   quest;
                QuestLog log  = MainGame.worldManager.worldQuests;
                QuestLog pLog = player.log;
                for (int i = 0; i < numQuests; i++)
                {
                    quest = (string)quests[i, 0];
                    if (log.ContainsQuest(quest))
                    {
                        pLog[quest]        = log[quest];
                        pLog[quest].Status = (int)quests[i, 1];
                    }
                }

                //add new quests to quest log
                foreach (Quest newQuest in log)
                {
                    if (!pLog.ContainsQuest(newQuest))
                    {
                        pLog.Add(newQuest);
                    }
                }

                //load the items
                Item.Inventory inventory = player.inventory;
                Item.Item      newItem;
                for (int i = 0; i < numItems; i++)
                {
                    string name = items[i];
                    //newItem.image = Sprites.spritesDictionary[newItem.name].Texture;
                    //figure out the save path
                    int    startname = saveLoc.LastIndexOf('/') + 1;
                    int    endname   = saveLoc.LastIndexOf('.');
                    string filename  = saveLoc.Substring(startname, endname - startname);
                    string directory = saveLoc.Substring(0, startname) + "/" + filename;
                    newItem = LoadItem(directory + "/" + name + ".item");
                    inventory.Add(newItem);
                }
                inventory.ActiveWeapon = activeItem;

                //add the player to the world
                MainGame.worldManager.CurrentWorld.manager.AddEntity(player);

                //add the player to the quests
                foreach (Quest loopQuest in MainGame.worldManager.worldQuests)
                {
                    loopQuest.player = player;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error reading file: " + e.Message);
                Console.WriteLine("Stack: \n\t" + e.StackTrace);
            }
            finally
            {
                if (input != null)
                {
                    input.Close();
                }
            }
        }
Example #15
0
        /// <summary>
        /// saves the game
        /// </summary>
        public void Save()
        {
            // Create a stream, then a writer
            Stream       outStream = null;
            BinaryWriter output    = null;

            try
            {
                if (!Directory.Exists("./Content/SaveFiles"))
                {
                    Directory.CreateDirectory("./Content/SaveFiles");
                }
                //initialize them
                outStream = File.OpenWrite(saveLoc);
                output    = new BinaryWriter(outStream);

                //Get the player
                Entity.Player player = MainGame.worldManager.CurrentWorld.manager.GetPlayer();

                //get the current world
                string world = MainGame.worldManager.CurrentWorldString;

                //get the player's stats
                int playerX      = player.location.IntX;
                int playerY      = player.location.IntY;
                int playerHealth = player.health;
                int pCash        = player.Cash;
                int pQuestPoints = player.QuestPoints;

                //get the quest statuses
                QuestLog log = player.log;
                object[,] questStatuses = new object[log.Count, 2];
                for (int i = 0; i < log.Count; i++)
                {
                    questStatuses[i, 0] = log[i].Name;
                    questStatuses[i, 1] = log[i].Status;
                }

                //get the items in the inventory
                List <string>  items     = new List <string>();
                Item.Inventory inventory = player.inventory;
                foreach (Item.Item item in inventory)
                {
                    items.Add(item.name);
                }

                //store all of the data in the file
                output.Write(world);
                output.Write(playerX);
                output.Write(playerY);
                output.Write(playerHealth);
                output.Write(pCash);
                output.Write(pQuestPoints);
                output.Write((Int32)log.Count);
                Console.WriteLine(log.Count);
                for (int i = 0; i < log.Count; i++)
                {
                    output.Write((string)questStatuses[i, 0]);
                    output.Write((int)questStatuses[i, 1]);
                }
                output.Write(items.Count);
                foreach (Item.Item item in inventory)
                {
                    if (SaveItem(item))
                    {
                        output.Write(item.name);
                    }
                }
                output.Write(inventory.ActiveWeapon);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error while saving the game: " + e.Message);
                Console.WriteLine("Stack: \n\t" + e.StackTrace);
            }
            finally
            {
                if (output != null)
                {
                    // Done writing
                    output.Close();
                }
            }
        }
Example #16
0
#pragma warning disable AvoidImplicitNetFieldCast // Netcode types shouldn't be implicitly converted
        static bool Prefix(SpriteBatch b, QuestLog __instance, List <List <Quest> > ___pages, int ___currentPage, int ___questPage = -1, string ___hoverText = "")
        {
            b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);
            SpriteText.drawStringWithScrollCenteredAt(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11373"), __instance.xPositionOnScreen + __instance.width / 2, __instance.yPositionOnScreen - 64, "", 1f, -1, 0, 0.88f, false);
            IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), __instance.xPositionOnScreen, __instance.yPositionOnScreen, __instance.width, __instance.height, Color.White, 4f, true);
            if (___questPage == -1)
            {
                for (int index = 0; index < __instance.questLogButtons.Count; ++index)
                {
                    if (___pages.Count() > 0 && ___pages[___currentPage].Count() > index)
                    {
                        IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 396, 15, 15), __instance.questLogButtons[index].bounds.X, __instance.questLogButtons[index].bounds.Y, __instance.questLogButtons[index].bounds.Width, __instance.questLogButtons[index].bounds.Height, __instance.questLogButtons[index].containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, 4f, false);
                        if ((bool)((NetFieldBase <bool, NetBool>)___pages[___currentPage][index].showNew) || (bool)((NetFieldBase <bool, NetBool>)___pages[___currentPage][index].completed))
                        {
                            Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(__instance.questLogButtons[index].bounds.X + 64 + 4, __instance.questLogButtons[index].bounds.Y + 44), new Rectangle((bool)((NetFieldBase <bool, NetBool>)___pages[___currentPage][index].completed) ? 341 : 317, 410, 23, 9), Color.White, 0.0f, new Vector2(11f, 4f), (float)(4.0 + Game1.dialogueButtonScale * 10.0 / 250.0), false, 0.99f, -1, -1, 0.35f);
                        }
                        else
                        {
                            Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(__instance.questLogButtons[index].bounds.X + 32, __instance.questLogButtons[index].bounds.Y + 28), (bool)((NetFieldBase <bool, NetBool>)___pages[___currentPage][index].dailyQuest) ? new Rectangle(410, 501, 9, 9) : new Rectangle(395 + ((bool)((NetFieldBase <bool, NetBool>)___pages[___currentPage][index].dailyQuest) ? 3 : 0), 497, 3, 8), Color.White, 0.0f, Vector2.Zero, 4f, false, 0.99f, -1, -1, 0.35f);
                        }

                        int num = (bool)((NetFieldBase <bool, NetBool>)___pages[___currentPage][index].dailyQuest) ? 1 : 0;
                        SpriteText.drawString(b, ___pages[___currentPage][index].questTitle, __instance.questLogButtons[index].bounds.X + 128 + 4, __instance.questLogButtons[index].bounds.Y + 20, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                    }
                }
            }
            else
            {
                SpriteText.drawStringHorizontallyCenteredAt(b, ___pages[___currentPage][___questPage].questTitle, __instance.xPositionOnScreen + __instance.width / 2 + (!(bool)((NetFieldBase <bool, NetBool>)___pages[___currentPage][___questPage].dailyQuest) || (int)((NetFieldBase <int, NetInt>)___pages[___currentPage][___questPage].daysLeft) <= 0 ? 0 : Math.Max(32, SpriteText.getWidthOfString(___pages[___currentPage][___questPage].questTitle, 999999) / 3) - 32), __instance.yPositionOnScreen + 32, 999999, -1, 999999, 1f, 0.88f, false, -1, 99999);
                if ((bool)((NetFieldBase <bool, NetBool>)___pages[___currentPage][___questPage].dailyQuest) && (int)((NetFieldBase <int, NetInt>)___pages[___currentPage][___questPage].daysLeft) > 0)
                {
                    Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(__instance.xPositionOnScreen + 32, __instance.yPositionOnScreen + 48 - 8), new Rectangle(410, 501, 9, 9), Color.White, 0.0f, Vector2.Zero, 4f, false, 0.99f, -1, -1, 0.35f);
                    Utility.drawTextWithShadow(b, Game1.parseText((int)((NetFieldBase <int, NetInt>)___pages[___currentPage][___questPage].daysLeft) > 1 ? Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11374", ___pages[___currentPage][___questPage].daysLeft) : Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11375", ___pages[___currentPage][___questPage].daysLeft), Game1.dialogueFont, __instance.width - 128), Game1.dialogueFont, new Vector2(__instance.xPositionOnScreen + 80, __instance.yPositionOnScreen + 48 - 8), Game1.textColor, 1f, -1f, -1, -1, 1f, 3);
                }
                Utility.drawTextWithShadow(b, Game1.parseText(___pages[___currentPage][___questPage].questDescription, Game1.dialogueFont, __instance.width - 128), Game1.dialogueFont, new Vector2(__instance.xPositionOnScreen + 64, __instance.yPositionOnScreen + 96), Game1.textColor, 1f, -1f, -1, -1, 1f, 3);
                float y = (float)(__instance.yPositionOnScreen + 96 + (double)Game1.dialogueFont.MeasureString(Game1.parseText(___pages[___currentPage][___questPage].questDescription, Game1.dialogueFont, __instance.width - 128)).Y + 32.0);
                if ((bool)((NetFieldBase <bool, NetBool>)___pages[___currentPage][___questPage].completed))
                {
                    SpriteText.drawString(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11376"), __instance.xPositionOnScreen + 32 + 4, __instance.rewardBox.bounds.Y + 21 + 4, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                    __instance.rewardBox.draw(b);
                    if ((int)((NetFieldBase <int, NetInt>)___pages[___currentPage][___questPage].moneyReward) > 0)
                    {
                        b.Draw(Game1.mouseCursors, new Vector2(__instance.rewardBox.bounds.X + 16, __instance.rewardBox.bounds.Y + 16 - Game1.dialogueButtonScale / 2f), new Rectangle?(new Rectangle(280, 410, 16, 16)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                        SpriteText.drawString(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", ___pages[___currentPage][___questPage].moneyReward), __instance.xPositionOnScreen + 448, __instance.rewardBox.bounds.Y + 21 + 4, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                    }
                }
                else
                {
                    Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(__instance.xPositionOnScreen + 96 + (float)(8.0 * Game1.dialogueButtonScale / 10.0), y), new Rectangle(412, 495, 5, 4), Color.White, 1.570796f, Vector2.Zero, -1f, false, -1f, -1, -1, 0.35f);
                    Utility.drawTextWithShadow(b, Game1.parseText(___pages[___currentPage][___questPage].currentObjective, Game1.dialogueFont, __instance.width - 256), Game1.dialogueFont, new Vector2(__instance.xPositionOnScreen + 128, y - 8f), Color.Yellow, 1f, -1f, -1, -1, 1f, 3);
                    if ((bool)((NetFieldBase <bool, NetBool>)___pages[___currentPage][___questPage].canBeCancelled))
                    {
                        __instance.cancelQuestButton.draw(b);
                    }
                }
            }
            if (___currentPage < ___pages.Count - 1 && ___questPage == -1)
            {
                __instance.forwardButton.draw(b);
            }

            if (___currentPage > 0 || ___questPage != -1)
            {
                __instance.backButton.draw(b);
            }

            //__instance.draw(b);
            Game1.mouseCursorTransparency = 1f;
            __instance.drawMouse(b);
            if (___hoverText.Length <= 0)
            {
                return(false);
            }

            IClickableMenu.drawHoverText(b, ___hoverText, Game1.dialogueFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null);
            return(false);
        }
Example #17
0
        /// <summary>
        /// Creates a new character and loads all required character data from the database
        /// </summary>
        /// <param name="acc">The account the character is associated with</param>
        /// <param name="record">The name of the character to load</param>
        /// <param name="client">The client to associate with this character</param>
        internal protected void Create(RealmAccount acc, CharacterRecord record, IRealmClient client)
        {
            client.ActiveCharacter = this;
            acc.ActiveCharacter    = this;

            Type        |= ObjectTypes.Player;
            ChatChannels = new List <ChatChannel>(5);

            m_logoutTimer = new TimerEntry(0, DefaultLogoutDelayMillis, totalTime => FinishLogout());

            Account  = acc;
            m_client = client;

            m_record = record;
            EntityId = EntityId.GetPlayerId(m_record.EntityLowId);
            m_name   = m_record.Name;

            Archetype  = ArchetypeMgr.GetArchetype(record.Race, record.Class);
            MainWeapon = GenericWeapon.Fists;
            PowerType  = m_archetype.Class.DefaultPowerType;

            StandState = StandState.Sit;

            Money  = (uint)m_record.Money;
            Outfit = m_record.Outfit;
            //ScaleX = m_archetype.Race.Scale;
            ScaleX     = 1;
            Gender     = m_record.Gender;
            Skin       = m_record.Skin;
            Facial     = m_record.Face;
            HairStyle  = m_record.HairStyle;
            HairColor  = m_record.HairColor;
            FacialHair = m_record.FacialHair;
            UnitFlags  = UnitFlags.PlayerControlled;
            Experience = m_record.Xp;
            RestXp     = m_record.RestXp;

            SetInt32(UnitFields.LEVEL, m_record.Level);
            // cannot use Level property, since it will trigger certain events that we don't want triggered
            NextLevelXP = XpGenerator.GetXpForlevel(m_record.Level + 1);
            MaxLevel    = RealmServerConfiguration.MaxCharacterLevel;

            RestState = RestState.Normal;

            Orientation = m_record.Orientation;

            m_bindLocation = new WorldZoneLocation(
                m_record.BindMap,
                new Vector3(m_record.BindX, m_record.BindY, m_record.BindZ),
                m_record.BindZone);

            PvPRank         = 1;
            YieldsXpOrHonor = true;

            foreach (var school in SpellConstants.AllDamageSchools)
            {
                SetFloat(PlayerFields.MOD_DAMAGE_DONE_PCT + (int)school, 1);
            }
            SetFloat(PlayerFields.DODGE_PERCENTAGE, 1.0f);

            // Auras
            m_auras = new PlayerAuraCollection(this);

            // spells
            m_spells = PlayerSpellCollection.Obtain(this);

            // factions
            WatchedFaction = m_record.WatchedFaction;
            Faction        = FactionMgr.ByRace[(uint)record.Race];
            m_reputations  = new ReputationCollection(this);

            // skills
            m_skills = new SkillCollection(this);

            // talents
            m_talents = new PlayerTalentCollection(this);

            // achievements
            m_achievements = new AchievementCollection(this);

            // Items
            m_inventory = new PlayerInventory(this);

            m_mailAccount = new MailAccount(this);

            m_questLog = new QuestLog(this);

            // tutorial flags
            TutorialFlags = new TutorialFlags(m_record.TutorialFlags);

            // Make sure client and internal state is updated with combat base values
            UnitUpdates.UpdateSpellCritChance(this);

            // Mask of activated TaxiNodes
            m_taxiNodeMask = new TaxiNodeMask();

            PowerCostMultiplier = 1f;

            m_lastPlayTimeUpdate = DateTime.Now;

            MoveControl.Mover      = this;
            MoveControl.CanControl = true;

            IncMeleePermissionCounter();

            SpeedFactor = DefaultSpeedFactor;

            // basic setup
            if (record.JustCreated)
            {
                ModStatsForLevel(m_record.Level);
                BasePower = RegenerationFormulas.GetPowerForLevel(this);
            }
            else
            {
                BaseHealth = m_record.BaseHealth;
                SetBasePowerDontUpdate(m_record.BasePower);

                SetBaseStat(StatType.Strength, m_record.BaseStrength);
                SetBaseStat(StatType.Stamina, m_record.BaseStamina);
                SetBaseStat(StatType.Spirit, m_record.BaseSpirit);
                SetBaseStat(StatType.Intellect, m_record.BaseIntellect);
                SetBaseStat(StatType.Agility, m_record.BaseAgility);

                Power = m_record.Power;
                SetInt32(UnitFields.HEALTH, m_record.Health);
            }
        }
Example #18
0
        private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
        {
            scene.GetRootGameObjects()[0].AddComponent <MagicStuff>();
            switch (scene.name)
            {
            case "MainMenu":
                GameObject.Find("EarlyAccess").gameObject.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "Questing Update " + version;
                GameObject.Find("SteamBranch").gameObject.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = updateName + " " + update;
                GameObject.Find("Version").gameObject.GetComponentInChildren <TMPro.TextMeshProUGUI>().text     = "Version: 1.25.72 (ClosedTesting)";
                break;

            case "Island":
                QuestLog.Log("---Questing Init Begin---");
                new QuestingDict();
                new ImportHandler();
                new ExportHandler();
                if (GlobalStorage.managerData[9].enabled)
                {
                    QuestLog.Log("---Addon Registration Begin---");
                    new AddonController();
                    QuestLog.Log("---Addon Registration End---");
                }

                if (GlobalStorage.managerData[0].enabled)
                {
                    QuestLog.Log("---Questing Items Begin---");
                    new QuestingItems().InitItems();
                    QuestLog.Log("[Questing Update | Main]: Items Done.");
                    QuestLog.Log("---Questing Items End---");
                }

                if (GlobalStorage.managerData[4].enabled)
                {
                    QuestLog.Log("---Questing Deposits Begin---");
                    new QuestingDeposits().InitDeposits();
                    QuestLog.Log("[Questing Update | Main]: Deposits Done.");
                    QuestLog.Log("---Questing Deposits End---");
                }

                if (GlobalStorage.managerData[5].enabled)
                {
                    QuestLog.Log("---Questing Categories Begin---");
                    new QuestingCategories().InitCategories();
                    QuestLog.Log("[Questing Update | Main]: Categories Done.");
                    QuestLog.Log("---Questing Categories End---");
                }

                if (GlobalStorage.managerData[2].enabled)
                {
                    QuestLog.Log("---Questing Modules Begin---");
                    new QuestingModules().InitModules();
                    QuestLog.Log("[Questing Update | Main]: Modules Done.");
                    QuestLog.Log("---Questing Modules End---");
                }

                if (GlobalStorage.managerData[3].enabled)
                {
                    QuestLog.Log("---Questing Stations Begin---");
                    new QuestingStations().InitStations();
                    QuestLog.Log("[Questing Update | Main]: Stations Done.");
                    QuestLog.Log("---Questing Stations End---");
                }

                if (GlobalStorage.managerData[1].enabled)
                {
                    QuestLog.Log("---Questing Recipes Begin---");
                    new QuestingRecipes().InitRecipes();
                    QuestLog.Log("[Questing Update | Main]: Recipes Done.");
                    QuestLog.Log("---Questing Recipes End---");
                }

                if (GlobalStorage.managerData[6].enabled)
                {
                    QuestLog.Log("---Questing Modifier Begin---");
                    new QuestingModifier().InitModifier();
                    QuestLog.Log("[Questing Update | Main]: Modifier Done.");
                    QuestLog.Log("---Questing Modifier End---");
                }

                if (GlobalStorage.managerData[10].enabled)
                {
                    QuestLog.Log("---Questing Weapons Begin---");
                    new QuestingWeapons();
                    QuestLog.Log("[Questing Update | Main]: Weapons Done.");
                    QuestLog.Log("---Questing Weapons End---");
                }

                if (GlobalStorage.managerData[8].enabled)
                {
                    QuestLog.Log("---Questing Quests Begin---");
                    new QuestingQuests().InitQuests();
                    QuestLog.Log("[Questing Update | Main]: Quests Done.");
                    QuestLog.Log("---Questing Quests End---");
                }

                ReturnAllData();
                QuestLog.Log("[Questing Update | Main]: Done with Init.");
                QuestLog.Log("---Questing Init End---");
                break;
            }
        }
Example #19
0
 public override void OnEnter()
 {
     QuestLog.AddQuestEntry(questName.Value, description.Value);
     Finish();
 }
Example #20
0
 public ExportHandler()
 {
     Export();
     QuestLog.Log("[Export Handler]: Export Complete");
 }
Example #21
0
        public override void OnStart()
        {
            // This reports problems, and stops BT processing if there was a problem with attributes...
            // We had to defer this action, as the 'profile line number' is not available during the element's
            // constructor call.
            OnStart_HandleAttributeProblem();

            // If the quest is complete, this behavior is already done...
            // So we don't want to falsely inform the user of things that will be skipped.
            if (!IsDone)
            {
                PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId);

                if (quest == null)
                { LogMessage("warning", "Cannot find quest with QuestId({0}).", QuestId); }

                else if ((quest != null) && quest.IsCompleted && (Type != AbandonType.All))
                { LogMessage("warning", "Quest({0}, \"{1}\") is Complete--skipping abandon.", QuestId, quest.Name); }

                else if ((quest != null) && !quest.IsFailed && (Type == AbandonType.Failed))
                { LogMessage("warning", "Quest({0}, \"{1}\") has not Failed--skipping abandon.", QuestId, quest.Name); }

                else
                {
                    TreeRoot.GoalText = string.Format("Abandoning QuestId({0}): \"{1}\"", QuestId, quest.Name);
                    QuestLog ql = new QuestLog();
                    ql.AbandonQuestById((uint)QuestId);
                    LogMessage("info", "Quest({0}, \"{1}\") successfully abandoned", QuestId, quest.Name);
                }

                _isBehaviorDone = true;
            }
        }
Example #22
0
    void OnGUI()
    {
        GUILayout.Label("Character Editor");
        // Player I want to update
        GUILayout.Label("");
        Transform OldCharacter = MyCharacter;

        MyCharacter = ((Transform)EditorGUI.ObjectField(new Rect(3, GUILayoutUtility.GetLastRect().y, 300, 18),
                                                        "Target Character",
                                                        MyCharacter,
                                                        typeof(Transform)));
        // if has selected new character
        if (MyCharacter != OldCharacter)
        {
            if (MyCharacter.GetComponent <Character> () == null)
            {
                MyCharacter = null;
            }
            else
            {
                GatherScript();
            }
        }

        if (MyCharacter)
        {
            IsEditScript = GUILayout.Toggle(IsEditScript, "Edit Script");
            GUILayout.Label(MyCharacter.name);
            if (!IsEditScript)
            {
                CharacterStats MyStats = MyCharacter.GetComponent <CharacterStats>();
                if (MyStats)
                {
                    GUILayout.Label("Stats");
                    if (MyStats.TempStats.GetSize() == 0)
                    {
                        GUILayout.Label("\tNone");
                    }
                    else
                    {
                        for (int i = 0; i < MyStats.TempStats.GetSize(); i++)
                        {
                            GUILayout.Label("\t" + MyStats.TempStats.GetStat(i).GetGuiString());
                        }
                    }
                }
                Inventory MyInventory = MyCharacter.GetComponent <Inventory>();
                if (MyInventory)
                {
                    GUILayout.Label("Items");
                    if (MyInventory.MyItems.Count == 0)
                    {
                        GUILayout.Label("\tNone");
                    }
                    else
                    {
                        for (int i = 0; i < MyInventory.MyItems.Count; i++)
                        {
                            GUILayout.Label("\t" + MyInventory.GetItem(i).GetDescription());
                        }
                    }
                }
                QuestLog MyQuestLog = MyCharacter.GetComponent <QuestLog>();
                if (MyQuestLog)
                {
                    GUILayout.Label("Quests");
                    if (MyQuestLog.MyQuests.Count == 0)
                    {
                        GUILayout.Label("\tNone");
                    }
                    else
                    {
                        for (int i = 0; i < MyQuestLog.MyQuests.Count; i++)
                        {
                            GUILayout.Label("\t" + MyQuestLog.MyQuests[i].GetDescriptionText());
                        }
                    }
                }
            }
            else
            {
                if (GUILayout.Button("Load: " + MyFileName))
                {
                    string OldFileName = MyFileName;
                    MyFileName = EditorUtility.OpenFilePanel(
                        "Select a script",
                        "",
                        "txt");
                    if (MyFileName != OldFileName)
                    {
                        CharacterSystem.CharacterSpawner.RunScript(MyCharacter, MyFileName);
                    }
                }

                if (GUILayout.Button("Activate Script"))
                {
                    CharacterSystem.SpeechFileReader.ActivateScript(MyCharacter, MyScript);
                }
                if (GUILayout.Button("Refresh Script"))
                {
                    GatherScript();
                }
                MyScript = GUILayout.TextArea(MyScript);

                /*for (int i = 0; i < MyScript.Count; i++)
                 * {
                 *      MyScript[i] = GUILayout.TextField(MyScript[i]);
                 * }*/
                /*string MyScript = CharacterSystem.SpeechFileReader.ReadTextFile(MyCharacter.name);
                 * GUILayout.Label(MyScript);*/
            }
        }
    }