Finished the crafting start window system. Added PassiveGuildleveQuests and refactors the Quest object. Cleaned up how zone music is handled.

This commit is contained in:
Filip Maj 2021-02-26 20:53:42 -05:00
parent f4e2280de8
commit 605b4918e2
34 changed files with 7121 additions and 4533 deletions

View file

@ -0,0 +1,92 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using MySql.Data.MySqlClient;
namespace Meteor.Map.dataobjects
{
class PassiveGuildleveData
{
public readonly uint id;
public readonly uint plateId;
public readonly uint borderId;
public readonly uint recommendedClass;
public readonly uint issuingLocation;
public readonly uint leveLocation;
public readonly uint deliveryDisplayName;
public readonly int[] objectiveItemId;
public readonly int[] objectiveQuantity;
public readonly int[] rewardItemId;
public readonly int[] rewardQuantity;
public readonly int[] numberOfAttempts;
public readonly int[] recommendedLevel;
public PassiveGuildleveData(MySqlDataReader reader)
{
id = reader.GetUInt32("id");
plateId = reader.GetUInt32("plateId");
borderId = reader.GetUInt32("borderId");
recommendedClass = reader.GetUInt32("recommendedClass");
issuingLocation = reader.GetUInt32("issuingLocation");
leveLocation = reader.GetUInt32("guildleveLocation");
deliveryDisplayName = reader.GetUInt32("deliveryDisplayName");
objectiveItemId = new int[4];
objectiveQuantity = new int[4];
rewardItemId = new int[4];
rewardQuantity = new int[4];
numberOfAttempts = new int[4];
recommendedLevel = new int[4];
objectiveItemId[0] = reader.GetInt32("objectiveItemId1");
objectiveItemId[1] = reader.GetInt32("objectiveItemId2");
objectiveItemId[2] = reader.GetInt32("objectiveItemId3");
objectiveItemId[3] = reader.GetInt32("objectiveItemId4");;
objectiveQuantity[0] = reader.GetInt32("objectiveQuantity1");
objectiveQuantity[1] = reader.GetInt32("objectiveQuantity2");
objectiveQuantity[2] = reader.GetInt32("objectiveQuantity3");
objectiveQuantity[3] = reader.GetInt32("objectiveQuantity4");
rewardItemId[0] = reader.GetInt32("rewardItemId1");
rewardItemId[1] = reader.GetInt32("rewardItemId2");
rewardItemId[2] = reader.GetInt32("rewardItemId3");
rewardItemId[3] = reader.GetInt32("rewardItemId4");
rewardQuantity[0] = reader.GetInt32("rewardQuantity1");
rewardQuantity[1] = reader.GetInt32("rewardQuantity2");
rewardQuantity[2] = reader.GetInt32("rewardQuantity3");
rewardQuantity[3] = reader.GetInt32("rewardQuantity4");
numberOfAttempts[0] = reader.GetInt32("numberOfAttempts1");
numberOfAttempts[1] = reader.GetInt32("numberOfAttempts2");
numberOfAttempts[2] = reader.GetInt32("numberOfAttempts3");
numberOfAttempts[3] = reader.GetInt32("numberOfAttempts4");
recommendedLevel[0] = reader.GetInt32("recommendedLevel1");
recommendedLevel[1] = reader.GetInt32("recommendedLevel2");
recommendedLevel[2] = reader.GetInt32("recommendedLevel3");
recommendedLevel[3] = reader.GetInt32("recommendedLevel4");
}
}
}

View file

@ -8,16 +8,28 @@ namespace Meteor.Map.DataObjects
{
class Recipe
{
public readonly uint id;
public readonly uint resultItemID;
public readonly uint resultQuantity;
public readonly uint[] materials;
public readonly byte[] allowedCrafters;
public readonly uint crystalId1;
public readonly uint crystalId2;
public readonly uint crystalQuantity1;
public readonly uint crystalQuantity2;
public readonly byte tier;
public Recipe(uint resultItemID, uint resultQuantity, byte[] allowedCrafters, byte tier)
public Recipe(uint id, uint resultItemID, uint resultQuantity, uint[] materials, uint crystalId1, uint crystalQuantity1, uint crystalId2, uint crystalQuantity2, byte[] allowedCrafters, byte tier)
{
this.id = id;
this.resultItemID = resultItemID;
this.resultQuantity = resultQuantity;
this.materials = materials;
this.allowedCrafters = allowedCrafters;
this.crystalId1 = crystalId1;
this.crystalId2 = crystalId2;
this.crystalQuantity1 = crystalQuantity1;
this.crystalQuantity2 = crystalQuantity2;
this.tier = tier;
}
}

View file

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Linq;
using MoonSharp.Interpreter;
namespace Meteor.Map.DataObjects
{
@ -37,8 +39,6 @@ namespace Meteor.Map.DataObjects
mats[6] = mat7;
mats[7] = mat8;
Array.Sort(mats);
byte[] result = new byte[8 * sizeof(int)];
Buffer.BlockCopy(mats, 0, result, 0, result.Length);
string hash;
@ -53,8 +53,33 @@ namespace Meteor.Map.DataObjects
return null;
}
public Recipe GetMatsForRecipe(uint recipeID)
public Recipe GetRecipeByItemID(int objectiveItemID)
{
return recipeList.Where(recipe => recipe.Value.resultItemID == objectiveItemID).FirstOrDefault().Value;
}
public DynValue RecipesToItemIdTable(List<Recipe> recipeList)
{
DynValue[] itemIDs = new DynValue[8];
for (int i = 0; i < 8; i++)
itemIDs[i] = recipeList != null && i < recipeList.Count ? DynValue.NewNumber(recipeList[i].resultItemID) : DynValue.NewNil();
return DynValue.NewTable(new Table(new Script(), itemIDs));
}
public DynValue RecipeToMatIdTable(Recipe recipe)
{
DynValue[] itemIDs = new DynValue[8];
for (int i = 0; i < 8; i++)
itemIDs[i] = DynValue.NewNumber(recipe.materials[i]);
return DynValue.NewTable(new Table(new Script(), itemIDs));
}
public Recipe GetRecipeByID(uint recipeID)
{
if (recipeID == 0)
return null;
if (recipeList.ContainsKey(recipeID))
return recipeList[recipeID];
else