Addition of random craft system.

Thanks to Mode.
This commit is contained in:
MobiusDevelopment
2021-01-16 01:43:14 +00:00
parent 10b0cf2c86
commit 8fdb533aa5
39 changed files with 6017 additions and 41 deletions

View File

@@ -0,0 +1,28 @@
DROP TABLE IF EXISTS `character_random_craft`;
CREATE TABLE IF NOT EXISTS `character_random_craft` (
`charId` INT UNSIGNED NOT NULL DEFAULT 0,
`random_craft_full_points` INT NOT NULL DEFAULT 0,
`random_craft_points` INT NOT NULL DEFAULT 0,
`sayha_roll` TINYINT NOT NULL DEFAULT 0,
`item_1_id` INT NOT NULL DEFAULT 0,
`item_1_count` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`item_1_locked` TINYINT NOT NULL DEFAULT 0,
`item_1_lock_left` INT NOT NULL DEFAULT 0,
`item_2_id` INT NOT NULL DEFAULT 0,
`item_2_count` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`item_2_locked` TINYINT NOT NULL DEFAULT 0,
`item_2_lock_left` INT NOT NULL DEFAULT 0,
`item_3_id` INT NOT NULL DEFAULT 0,
`item_3_count` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`item_3_locked` TINYINT NOT NULL DEFAULT 0,
`item_3_lock_left` INT NOT NULL DEFAULT 0,
`item_4_id` INT NOT NULL DEFAULT 0,
`item_4_count` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`item_4_locked` TINYINT NOT NULL DEFAULT 0,
`item_4_lock_left` INT NOT NULL DEFAULT 0,
`item_5_id` INT NOT NULL DEFAULT 0,
`item_5_count` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`item_5_locked` TINYINT NOT NULL DEFAULT 0,
`item_5_lock_left` INT NOT NULL DEFAULT 0,
PRIMARY KEY (`charId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

View File

@@ -654,14 +654,6 @@ EnableAutoBuff = True
EnableAutoItem = True
# ---------------------------------------------------------------------------
# Random Craft Settings
# ---------------------------------------------------------------------------
# Drop materials for random craft.
DropRandomCraftMaterials = False
# ---------------------------------------------------------------------------
# Developer Settings
# ---------------------------------------------------------------------------

View File

@@ -0,0 +1,12 @@
# ---------------------------------------------------------------------------
# Random Craft Settings
# ---------------------------------------------------------------------------
# Enable random craft system.
RandomCraftEnabled = False
# Drop materials for random craft.
# Cannot be reloaded. It needs server restart.
# Works independently from above config.
# Recommend to use same value as RandomCraftEnabled.
DropRandomCraftMaterials = False

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,236 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/RandomCraftRewardData.xsd">
<!-- The default chance of an item to be added to the player random craft rewards is 100%. -->
<!-- If you want to reduce the change for an item to be shown, you can add a lower chance value. -->
<!-- You can also add an announce value if you want the craft to be announced on the server. -->
<rewards>
<item id="93047" chance="50" /> <!-- Samurai Long Sword -->
<item id="93048" chance="50" /> <!-- Demon's Staff -->
<item id="93049" chance="50" /> <!-- Ecliptic Axe -->
<item id="93050" chance="50" /> <!-- Crystal Dagger -->
<item id="93051" chance="50" /> <!-- Eminence Bow -->
<item id="93052" chance="50" /> <!-- Orcish Poleaxe -->
<item id="93053" chance="50" /> <!-- Katana*Katana -->
<item id="93054" chance="50" /> <!-- Yaksa Mace -->
<item id="93055" chance="50" /> <!-- Berserker Blade -->
<item id="93056" chance="50" /> <!-- Great Pata -->
<item id="93057" chance="50" /> <!-- Admiral's Estoc -->
<item id="93058" chance="50" /> <!-- Saber Tooth -->
<item id="93422" chance="25" /> <!-- Damascus Sword -->
<item id="93423" chance="25" /> <!-- Lance -->
<item id="93424" chance="25" /> <!-- Deadman's Glory -->
<item id="93425" chance="25" /> <!-- Art of Battle Axe -->
<item id="93426" chance="25" /> <!-- Staff of Evil Spirits -->
<item id="93427" chance="25" /> <!-- Demon's Dagger -->
<item id="93428" chance="25" /> <!-- Bellion Cestus -->
<item id="93429" chance="25" /> <!-- Bow of Peril -->
<item id="93430" chance="25" /> <!-- Samurai Long Sword*Samurai Long Sword -->
<item id="93431" chance="25" /> <!-- Guardian's Sword -->
<item id="93432" chance="25" /> <!-- Wizard's Tear -->
<item id="93433" chance="25" /> <!-- Star Buster -->
<item id="93434" chance="25" /> <!-- Dismantler -->
<item id="93435" chance="25" /> <!-- Colichemarde -->
<item id="92930" chance="12.5" /> <!-- Tallum Blade -->
<item id="92931" chance="12.5" /> <!-- Dragon Slayer -->
<item id="92932" chance="12.5" /> <!-- Halberd -->
<item id="92933" chance="12.5" /> <!-- Elemental Sword -->
<item id="92934" chance="12.5" /> <!-- Sword of Miracles -->
<item id="92935" chance="12.5" /> <!-- Elysian -->
<item id="92936" chance="12.5" /> <!-- Dasparion's Staff -->
<item id="92937" chance="12.5" /> <!-- Branch of the Mother Tree -->
<item id="92938" chance="12.5" /> <!-- Bloody Orchid -->
<item id="92939" chance="12.5" /> <!-- Soul Separator -->
<item id="92940" chance="12.5" /> <!-- Blood Tornado -->
<item id="92941" chance="12.5" /> <!-- Dragon Grinder -->
<item id="92942" chance="12.5" /> <!-- Carnage Bow -->
<item id="92943" chance="12.5" /> <!-- Soul Bow -->
<item id="92944" chance="12.5" /> <!-- Tallum Glaive -->
<item id="92945" chance="12.5" /> <!-- Dark Legion's Edge -->
<item id="92946" chance="12.5" /> <!-- Meteor Shower -->
<item id="92947" chance="12.5" /> <!-- Keshanberk*Keshanberk -->
<item id="92948" chance="12.5" /> <!-- Keshanberk*Damascus -->
<item id="92949" chance="12.5" /> <!-- Damascus*Damascus -->
<item id="92970" chance="12.5" /> <!-- Éclair Bijou -->
<item id="92971" chance="12.5" /> <!-- Lacerator -->
<item id="92972" chance="12.5" /> <!-- White Lightning -->
<item id="93639" /> <!-- Full Plate Helmet -->
<item id="93640" /> <!-- Full Plate Boots -->
<item id="93641" /> <!-- Full Plate Gauntlets -->
<item id="93642" /> <!-- Full Plate Armor -->
<item id="93643" /> <!-- Drake Leather Armor -->
<item id="93644" /> <!-- Drake Leather Boots -->
<item id="93645" /> <!-- Drake Leather Gloves -->
<item id="93646" /> <!-- Karmian Tunic -->
<item id="93647" /> <!-- Karmian Stockings -->
<item id="93648" /> <!-- Karmian Boots -->
<item id="93649" /> <!-- Karmian Gloves -->
<item id="93501" chance="50" /> <!-- Zubei's Breastplate -->
<item id="93502" chance="50" /> <!-- Blue Wolf Breastplate -->
<item id="93503" chance="50" /> <!-- Zubei's Gaiters -->
<item id="93504" chance="50" /> <!-- Avadon Breastplate -->
<item id="93505" chance="50" /> <!-- Avadon Gaiters -->
<item id="93506" chance="50" /> <!-- Blue Wolf Gaiters -->
<item id="93507" chance="50" /> <!-- Doom Plate Armor -->
<item id="93508" chance="50" /> <!-- Zubei's Leather Shirt -->
<item id="93509" chance="50" /> <!-- Zubei's Leather Gaiters -->
<item id="93510" chance="50" /> <!-- Avadon Leather Armor -->
<item id="93511" chance="50" /> <!-- Blue Wolf Leather Armor -->
<item id="93512" chance="50" /> <!-- Doom Leather Armor -->
<item id="93513" chance="50" /> <!-- Zubei's Tunic -->
<item id="93514" chance="50" /> <!-- Blue Wolf Tunic -->
<item id="93515" chance="50" /> <!-- Doom Tunic -->
<item id="93516" chance="50" /> <!-- Zubei's Stockings -->
<item id="93517" chance="50" /> <!-- Blue Wolf Stockings -->
<item id="93518" chance="50" /> <!-- Doom Stockings -->
<item id="93519" chance="50" /> <!-- Avadon Robe -->
<item id="93520" chance="50" /> <!-- Zubei's Gauntlets (Heavy) -->
<item id="93521" chance="50" /> <!-- Zubei's Gauntlets (Light) -->
<item id="93522" chance="50" /> <!-- Zubei's Gauntlets (Robe) -->
<item id="93523" chance="50" /> <!-- Avadon Gloves (Heavy) -->
<item id="93524" chance="50" /> <!-- Avadon Gloves (Light) -->
<item id="93525" chance="50" /> <!-- Avadon Gloves (Robe) -->
<item id="93526" chance="50" /> <!-- Blue Wolf Gloves (Heavy) -->
<item id="93527" chance="50" /> <!-- Blue Wolf Gloves (Light) -->
<item id="93528" chance="50" /> <!-- Blue Wolf Gloves (Robe) -->
<item id="93529" chance="50" /> <!-- Doom Gloves (Heavy) -->
<item id="93530" chance="50" /> <!-- Doom Gloves (Light) -->
<item id="93531" chance="50" /> <!-- Doom Gloves (Robe) -->
<item id="93532" chance="50" /> <!-- Zubei's Boots (Heavy) -->
<item id="93533" chance="50" /> <!-- Zubei's Boots (Light) -->
<item id="93534" chance="50" /> <!-- Zubei's Boots (Robe) -->
<item id="93535" chance="50" /> <!-- Avadon Boots (Heavy) -->
<item id="93536" chance="50" /> <!-- Avadon Boots (Light) -->
<item id="93537" chance="50" /> <!-- Avadon Boots (Robe) -->
<item id="93538" chance="50" /> <!-- Blue Wolf Boots (Heavy) -->
<item id="93539" chance="50" /> <!-- Blue Wolf Boots (Light) -->
<item id="93540" chance="50" /> <!-- Blue Wolf Boots (Robe) -->
<item id="93541" chance="50" /> <!-- Doom Boots (Heavy) -->
<item id="93542" chance="50" /> <!-- Doom Boots (Light) -->
<item id="93543" chance="50" /> <!-- Doom Boots (Robe) -->
<item id="93544" chance="50" /> <!-- Avadon Circlet (Heavy Armor) -->
<item id="93545" chance="50" /> <!-- Avadon Circlet (Light Armor) -->
<item id="93546" chance="50" /> <!-- Avadon Circlet (Robe) -->
<item id="93547" chance="50" /> <!-- Zubei's Helmet - Heavy Armor -->
<item id="93548" chance="50" /> <!-- Zubei's Helmet - Light Armor -->
<item id="93549" chance="50" /> <!-- Zubei's Helmet - Robe -->
<item id="93550" chance="50" /> <!-- Blue Wolf Helmet - Heavy Armor -->
<item id="93551" chance="50" /> <!-- Blue Wolf Helmet - Light Armor -->
<item id="93552" chance="50" /> <!-- Blue Wolf Helmet - Robe -->
<item id="93553" chance="50" /> <!-- Doom Helmet - Heavy Armor -->
<item id="93554" chance="50" /> <!-- Doom Helmet - Light Armor -->
<item id="93555" chance="50" /> <!-- Doom Helmet - Robe -->
<item id="92384" chance="50" /> <!-- Black Ore Earring -->
<item id="92385" chance="50" /> <!-- Black Ore Ring -->
<item id="92386" chance="50" /> <!-- Black Ore Necklace -->
<item id="92255" chance="25" /> <!-- Dark Crystal Breastplate -->
<item id="92256" chance="25" /> <!-- Armor of Nightmare -->
<item id="92257" chance="25" /> <!-- Dark Crystal Gaiters -->
<item id="92258" chance="25" /> <!-- Dark Crystal Helmet -->
<item id="92259" chance="25" /> <!-- Tallum Helmet -->
<item id="92261" chance="25" /> <!-- Tallum Plate Armor -->
<item id="92262" chance="25" /> <!-- Majestic Plate Armor -->
<item id="92263" chance="25" /> <!-- Dark Crystal Leather Armor -->
<item id="92264" chance="25" /> <!-- Dark Crystal Leggings -->
<item id="92265" chance="25" /> <!-- Tallum Leather Armor -->
<item id="92266" chance="25" /> <!-- Leather Armor of Nightmare -->
<item id="92267" chance="25" /> <!-- Majestic Leather Armor -->
<item id="92268" chance="25" /> <!-- Tallum Tunic -->
<item id="92269" chance="25" /> <!-- Tallum Stockings -->
<item id="92270" chance="25" /> <!-- Dark Crystal Robe -->
<item id="92271" chance="25" /> <!-- Robe of Nightmare -->
<item id="92272" chance="25" /> <!-- Majestic Robe -->
<item id="92273" chance="25" /> <!-- Helm of Nightmare -->
<item id="92274" chance="25" /> <!-- Majestic Circlet -->
<item id="92275" chance="25" /> <!-- Dark Crystal Gloves -->
<item id="92277" chance="25" /> <!-- Dark Crystal Gloves (Heavy) -->
<item id="92278" chance="25" /> <!-- Dark Crystal Gloves (Light) -->
<item id="92279" chance="25" /> <!-- Dark Crystal Gloves (Robe) -->
<item id="92280" chance="25" /> <!-- Tallum Gloves (Heavy) -->
<item id="92281" chance="25" /> <!-- Tallum Gloves (Light) -->
<item id="92282" chance="25" /> <!-- Tallum Gloves (Robe) -->
<item id="92283" chance="25" /> <!-- Gauntlets of Nightmare (Heavy) -->
<item id="92284" chance="25" /> <!-- Gauntlets of Nightmare (Light) -->
<item id="92285" chance="25" /> <!-- Gauntlets of Nightmare (Robe) -->
<item id="92286" chance="25" /> <!-- Majestic Gauntlets (Heavy) -->
<item id="92287" chance="25" /> <!-- Majestic Gauntlets (Light) -->
<item id="92288" chance="25" /> <!-- Majestic Gauntlets (Robe) -->
<item id="92289" chance="25" /> <!-- Dark Crystal Boots (Heavy) -->
<item id="92290" chance="25" /> <!-- Dark Crystal Boots (Light) -->
<item id="92291" chance="25" /> <!-- Dark Crystal Boots (Robe) -->
<item id="92292" chance="25" /> <!-- Tallum Boots (Heavy) -->
<item id="92293" chance="25" /> <!-- Tallum Boots (Light) -->
<item id="92294" chance="25" /> <!-- Tallum Boots (Robe) -->
<item id="92295" chance="25" /> <!-- Boots of Nightmare (Heavy) -->
<item id="92296" chance="25" /> <!-- Boots of Nightmare (Light) -->
<item id="92297" chance="25" /> <!-- Boots of Nightmare (Robe) -->
<item id="92298" chance="25" /> <!-- Majestic Boots (Heavy) -->
<item id="92299" chance="25" /> <!-- Majestic Boots (Light) -->
<item id="92300" chance="25" /> <!-- Majestic Boots (Robe) -->
<item id="92301" chance="25" /> <!-- Tallum Helmet - Heavy Armor -->
<item id="92302" chance="25" /> <!-- Tallum Helmet - Light Armor -->
<item id="92303" chance="25" /> <!-- Tallum Helmet - Robe -->
<item id="92304" chance="25" /> <!-- Dark Crystal Helmet - Heavy Armor -->
<item id="92305" chance="25" /> <!-- Dark Crystal Helmet - Light Armor -->
<item id="92306" chance="25" /> <!-- Dark Crystal Helmet - Robe -->
<item id="92307" chance="25" /> <!-- Helm of Nightmare (Heavy) -->
<item id="92308" chance="25" /> <!-- Helm of Nightmare (Light) -->
<item id="92309" chance="25" /> <!-- Helm of Nightmare (Robe) -->
<item id="92310" chance="25" /> <!-- Majestic Circlet (Heavy) -->
<item id="92311" chance="25" /> <!-- Majestic Circlet (Light) -->
<item id="92312" chance="25" /> <!-- Majestic Circlet (Robe) -->
<item id="92260" chance="25" /> <!-- Dark Crystal Shield -->
<item id="92276" chance="25" /> <!-- Shield of Nightmare -->
<item id="93109" chance="10" /> <!-- Wooden Sigil -->
<item id="93110" chance="10" /> <!-- Elven Sigil -->
<item id="93111" chance="10" /> <!-- Chain Sigil -->
<item id="93112" chance="10" /> <!-- Sigil of Demon -->
<item id="93113" chance="10" /> <!-- Sigil of Blue Wolf -->
<item id="93114" chance="10" /> <!-- Avadon Sigil -->
<item id="93115" chance="10" /> <!-- Doom Sigil -->
<item id="93116" chance="10" /> <!-- Zubei's Sigil -->
<item id="93117" chance="10" /> <!-- Dark Crystal Sigil -->
<item id="93118" chance="10" /> <!-- Tallum Sigil -->
<item id="93119" chance="10" /> <!-- Sigil of Nightmare -->
<item id="93120" chance="10" /> <!-- Majestic Sigil -->
<item id="93076" chance="7" announce="true" /> <!-- Gloves of Silence -->
<item id="93141" chance="7" announce="true" /> <!-- Ice Crystal Breastplate -->
<item id="93142" chance="7" announce="true" /> <!-- Ice Crystal Gaiters -->
<item id="93317" chance="7" announce="true" /> <!-- Leather Armor of Lightning -->
<item id="93318" chance="7" announce="true" /> <!-- Leather Leggings of Lightning -->
<item id="93735" chance="7" announce="true" /> <!-- Flaming Tunic -->
<item id="93736" chance="7" announce="true" /> <!-- Flaming Stockings -->
<item id="94084" chance="7" announce="true" /> <!-- Helmet of Mana -->
<item id="94086" chance="7" announce="true" /> <!-- Boots of Evasion -->
<item id="94264" chance="7" announce="true" /> <!-- Stun Gauntlets -->
<item id="90934" chance="33.3" /> <!-- Brooch Lv. 3 -->
<item id="91912" count="10000" /> <!-- HP Potion (Exchangeable) -->
<item id="91031" /> <!-- Water Spirit Evolution Stone -->
<item id="91032" /> <!-- Fire Spirit Evolution Stone -->
<item id="91033" /> <!-- Wind Spirit Evolution Stone -->
<item id="91034" /> <!-- Earth Spirit Evolution Stone -->
<item id="93103" /> <!-- Spellbook: Divine Beam -->
<item id="93384" /> <!-- Spellbook: Burning Field -->
<item id="93385" /> <!-- Spellbook: Frozen Field -->
<item id="93386" /> <!-- Spellbook: Lightning Storm -->
<item id="93387" /> <!-- Spellbook: Ultimate Death Knight Transformation -->
<item id="93631" /> <!-- Spellbook: Hellfire -->
<item id="93867" /> <!-- Spellbook: Amazing Thunder Storm Mastery -->
<item id="93869" /> <!-- Spellbook: Elemental Burst -->
<item id="93870" /> <!-- Spellbook: Ethereal Strike -->
<item id="93871" /> <!-- Spellbook: Knight's Help -->
<item id="91944" /> <!-- Book of Light -->
<item id="91945" /> <!-- Book of Shadows -->
<item id="90907" count="100" /> <!-- Soulshot Ticket -->
<item id="5126" /> <!-- Dual Sword Crafting Stamp -->
<item id="3031" count="1500" /> <!-- Spirit Ore -->
<item id="91840" count="10" /> <!-- XP Growth Scroll (Event) -->
<item id="730" /> <!-- Scroll: Enchant A-grade Armor (Exchangeable) -->
<item id="948" /> <!-- Scroll: Enchant B-grade Armor (Exchangeable) -->
<item id="952" /> <!-- Scroll: Enchant C-grade Armor (Exchangeable) -->
<item id="956" /> <!-- Scroll: Enchant D-grade Armor (Exchangeable) -->
<item id="729" /> <!-- Scroll: Enchant A-grade Weapon (Exchangeable) -->
<item id="947" /> <!-- Scroll: Enchant B-grade Weapon (Exchangeable) -->
<item id="951" /> <!-- Scroll: Enchant C-grade Weapon (Exchangeable) -->
<item id="955" /> <!-- Scroll: Enchant D-grade Weapon (Exchangeable) -->
</rewards>
</list>

View File

@@ -46,6 +46,7 @@ import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.data.xml.NpcNameLocalisationData;
import org.l2jmobius.gameserver.data.xml.OptionData;
import org.l2jmobius.gameserver.data.xml.PrimeShopData;
import org.l2jmobius.gameserver.data.xml.RandomCraftData;
import org.l2jmobius.gameserver.data.xml.SayuneData;
import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
import org.l2jmobius.gameserver.data.xml.SkillData;
@@ -369,6 +370,12 @@ public class AdminReload implements IAdminCommandHandler
AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Equipment Upgrade data.");
break;
}
case "randomcraft":
{
RandomCraftData.getInstance().load();
AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Random Craft data.");
break;
}
default:
{
activeChar.sendMessage(RELOAD_USAGE);

View File

@@ -0,0 +1,25 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="extract">
<xs:complexType>
<xs:sequence>
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:int" name="id" use="required"/>
<xs:attribute type="xs:long" name="points" use="required"/>
<xs:attribute type="xs:long" name="fee" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -0,0 +1,26 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="rewards">
<xs:complexType>
<xs:sequence>
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:int" name="id" use="required"/>
<xs:attribute type="xs:long" name="count" use="optional"/>
<xs:attribute type="xs:double" name="chance" use="optional"/>
<xs:attribute type="xs:boolean" name="announce" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -107,6 +107,7 @@ public class Config
private static final String HEXID_FILE = "./config/hexid.txt";
private static final String IPCONFIG_FILE = "./config/ipconfig.xml";
private static final String MAGIC_LAMP_FILE = "./config/MagicLamp.ini";
private static final String RANDOM_CRAFT_FILE = "./config/RandomCraft.ini";
// --------------------------------------------------
// Custom Config File Definitions
@@ -591,7 +592,6 @@ public class Config
public static boolean ENABLE_AUTO_POTION;
public static boolean ENABLE_AUTO_BUFF;
public static boolean ENABLE_AUTO_ITEM;
public static boolean DROP_RANDOM_CRAFT_MATERIALS;
// --------------------------------------------------
// FloodProtector Settings
@@ -857,13 +857,17 @@ public class Config
public static boolean ONLY_CMD_LINE_LOGIN;
// Magic Lamp
public static boolean MAGIC_LAMP_ENABLE;
public static boolean ENABLE_MAGIC_LAMP;
public static int MAGIC_LAMP_MAX_GAME_COUNT;
public static int MAGIC_LAMP_REWARD_COUNT;
public static int MAGIC_LAMP_GREATER_REWARD_COUNT;
public static int MAGIC_LAMP_MAX_LEVEL_EXP;
public static double MAGIC_LAMP_CHARGE_RATE;
// Random Craft
public static boolean ENABLE_RANDOM_CRAFT;
public static boolean DROP_RANDOM_CRAFT_MATERIALS;
// GrandBoss Settings
// Antharas
@@ -1879,15 +1883,20 @@ public class Config
TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000);
TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 10000);
// Load Training Camp config file (if exists)
// Load Magic Lamp config file (if exists)
final PropertiesParser magicLampSettings = new PropertiesParser(MAGIC_LAMP_FILE);
MAGIC_LAMP_ENABLE = magicLampSettings.getBoolean("MagicLampEnabled", false);
ENABLE_MAGIC_LAMP = magicLampSettings.getBoolean("MagicLampEnabled", false);
MAGIC_LAMP_MAX_GAME_COUNT = magicLampSettings.getInt("MagicLampMaxGames", 300);
MAGIC_LAMP_REWARD_COUNT = magicLampSettings.getInt("MagicLampRewardCount", 1);
MAGIC_LAMP_GREATER_REWARD_COUNT = magicLampSettings.getInt("MagicLampGreaterRewardCount", 10);
MAGIC_LAMP_MAX_LEVEL_EXP = magicLampSettings.getInt("MagicLampMaxLevelExp", 10000000);
MAGIC_LAMP_CHARGE_RATE = magicLampSettings.getDouble("MagicLampChargeRate", 0.1);
// Load Random Craft config file (if exists)
final PropertiesParser randomCraftSettings = new PropertiesParser(RANDOM_CRAFT_FILE);
ENABLE_RANDOM_CRAFT = randomCraftSettings.getBoolean("RandomCraftEnabled", false);
DROP_RANDOM_CRAFT_MATERIALS = randomCraftSettings.getBoolean("DropRandomCraftMaterials", false);
// Load Training Camp config file (if exists)
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);
TRAINING_CAMP_ENABLE = trainingCampSettings.getBoolean("TrainingCampEnable", false);
@@ -2060,7 +2069,6 @@ public class Config
ENABLE_AUTO_POTION = General.getBoolean("EnableAutoPotion", true);
ENABLE_AUTO_BUFF = General.getBoolean("EnableAutoBuff", true);
ENABLE_AUTO_ITEM = General.getBoolean("EnableAutoItem", true);
DROP_RANDOM_CRAFT_MATERIALS = General.getBoolean("DropRandomCraftMaterials", true);
// Load FloodProtector config file
final PropertiesParser FloodProtectors = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE);

View File

@@ -91,6 +91,7 @@ import org.l2jmobius.gameserver.data.xml.PetSkillData;
import org.l2jmobius.gameserver.data.xml.PlayerTemplateData;
import org.l2jmobius.gameserver.data.xml.PlayerXpPercentLostData;
import org.l2jmobius.gameserver.data.xml.PrimeShopData;
import org.l2jmobius.gameserver.data.xml.RandomCraftData;
import org.l2jmobius.gameserver.data.xml.RecipeData;
import org.l2jmobius.gameserver.data.xml.ResidenceFunctionsData;
import org.l2jmobius.gameserver.data.xml.SayuneData;
@@ -285,6 +286,7 @@ public class GameServer
LuckyGameData.getInstance();
AttendanceRewardData.getInstance();
MagicLampData.getInstance();
RandomCraftData.getInstance();
printSection("Characters");
ClassListData.getInstance();

View File

@@ -71,7 +71,7 @@ public class MagicLampData implements IXmlReader
public void addLampExp(PlayerInstance player, double exp, boolean rateModifiers)
{
if (Config.MAGIC_LAMP_ENABLE)
if (Config.ENABLE_MAGIC_LAMP)
{
final int lampExp = (int) (exp * (rateModifiers ? Config.MAGIC_LAMP_CHARGE_RATE * player.getStat().getMul(Stat.MAGIC_LAMP_EXP_RATE, 1) : 1));
int calc = lampExp + player.getLampExp();

View File

@@ -0,0 +1,173 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.RandomCraftExtractDataHolder;
import org.l2jmobius.gameserver.model.holders.RandomCraftRewardDataHolder;
import org.l2jmobius.gameserver.model.holders.RandomCraftRewardItemHolder;
import org.l2jmobius.gameserver.model.items.Item;
/**
* @author Mode, Mobius
*/
public class RandomCraftData implements IXmlReader
{
private static final Map<Integer, RandomCraftExtractDataHolder> EXTRACT_DATA = new HashMap<>();
private static final Map<Integer, RandomCraftRewardDataHolder> REWARD_DATA = new HashMap<>();
protected RandomCraftData()
{
load();
}
@Override
public void load()
{
EXTRACT_DATA.clear();
parseDatapackFile("data/RandomCraftExtractData.xml");
final int extractCount = EXTRACT_DATA.size();
if (extractCount > 0)
{
LOGGER.info(getClass().getSimpleName() + ": Loaded " + extractCount + " extraction data.");
}
REWARD_DATA.clear();
parseDatapackFile("data/RandomCraftRewardData.xml");
final int rewardCount = REWARD_DATA.size();
if (rewardCount > 4)
{
LOGGER.info(getClass().getSimpleName() + ": Loaded " + rewardCount + " rewards.");
}
else if (rewardCount > 0)
{
LOGGER.info(getClass().getSimpleName() + ": Random craft rewards should be more than " + rewardCount + ".");
REWARD_DATA.clear();
}
}
@Override
public void parseDocument(Document doc, File f)
{
forEach(doc, "list", listNode -> forEach(listNode, "extract", extractNode ->
{
forEach(extractNode, "item", itemNode ->
{
final StatSet stats = new StatSet(parseAttributes(itemNode));
final int itemId = stats.getInt("id");
final long points = stats.getLong("points");
final long fee = stats.getLong("fee");
EXTRACT_DATA.put(itemId, new RandomCraftExtractDataHolder(points, fee));
});
}));
forEach(doc, "list", listNode -> forEach(listNode, "rewards", rewardNode ->
{
forEach(rewardNode, "item", itemNode ->
{
final StatSet stats = new StatSet(parseAttributes(itemNode));
final int itemId = stats.getInt("id");
final Item item = ItemTable.getInstance().getTemplate(itemId);
if (item == null)
{
LOGGER.warning(getClass().getSimpleName() + " unexisting item reward: " + itemId);
}
else
{
REWARD_DATA.put(itemId, new RandomCraftRewardDataHolder(stats.getInt("id"), stats.getLong("count", 1), Math.min(100, Math.max(0.00000000000001, stats.getDouble("chance", 100))), stats.getBoolean("announce", false)));
}
});
}));
}
public boolean isEmpty()
{
return REWARD_DATA.isEmpty();
}
public RandomCraftRewardItemHolder getNewReward()
{
final List<RandomCraftRewardDataHolder> rewards = new ArrayList<>(REWARD_DATA.values());
Collections.shuffle(rewards);
RandomCraftRewardItemHolder result = null;
while (result == null)
{
SEARCH: for (RandomCraftRewardDataHolder reward : rewards)
{
if (Rnd.get(100d) < reward.getChance())
{
result = new RandomCraftRewardItemHolder(reward.getItemId(), reward.getCount(), false, 20);
break SEARCH;
}
}
}
return result;
}
public boolean isAnnounce(int id)
{
final RandomCraftRewardDataHolder holder = REWARD_DATA.get(id);
if (holder == null)
{
return false;
}
return holder.isAnnounce();
}
public long getPoints(int id)
{
final RandomCraftExtractDataHolder holder = EXTRACT_DATA.get(id);
if (holder == null)
{
return 0;
}
return holder.getPoints();
}
public long getFee(int id)
{
final RandomCraftExtractDataHolder holder = EXTRACT_DATA.get(id);
if (holder == null)
{
return 0;
}
return holder.getFee();
}
public static RandomCraftData getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final RandomCraftData INSTANCE = new RandomCraftData();
}
}

View File

@@ -235,6 +235,7 @@ import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.itemcontainer.ItemContainer;
import org.l2jmobius.gameserver.model.itemcontainer.PlayerFreight;
import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory;
import org.l2jmobius.gameserver.model.itemcontainer.PlayerRandomCraft;
import org.l2jmobius.gameserver.model.itemcontainer.PlayerRefund;
import org.l2jmobius.gameserver.model.itemcontainer.PlayerWarehouse;
import org.l2jmobius.gameserver.model.items.Armor;
@@ -883,6 +884,8 @@ public class PlayerInstance extends Playable
private ScheduledFuture<?> _timedHuntingZoneFinishTask = null;
private PlayerRandomCraft _randomCraft = null;
private final List<QuestTimer> _questTimers = new ArrayList<>();
private final List<TimerHolder<?>> _timerHolders = new ArrayList<>();
@@ -3394,7 +3397,7 @@ public class PlayerInstance extends Playable
}
// LCoin UI update.
if (destoyedItem.getId() == ExBloodyCoinCount.LCOIN_ID)
if (destoyedItem.getId() == Inventory.LCOIN_ID)
{
sendPacket(new ExBloodyCoinCount(this));
}
@@ -3509,7 +3512,7 @@ public class PlayerInstance extends Playable
}
// LCoin UI update.
if (item.getId() == ExBloodyCoinCount.LCOIN_ID)
if (item.getId() == Inventory.LCOIN_ID)
{
sendPacket(new ExBloodyCoinCount(this));
}
@@ -3584,7 +3587,7 @@ public class PlayerInstance extends Playable
}
// LCoin UI update.
if (newItem.getId() == ExBloodyCoinCount.LCOIN_ID)
if (newItem.getId() == Inventory.LCOIN_ID)
{
sendPacket(new ExBloodyCoinCount(this));
}
@@ -3697,7 +3700,7 @@ public class PlayerInstance extends Playable
}
// LCoin UI update.
if (item.getId() == ExBloodyCoinCount.LCOIN_ID)
if (item.getId() == Inventory.LCOIN_ID)
{
sendPacket(new ExBloodyCoinCount(this));
}
@@ -3777,7 +3780,7 @@ public class PlayerInstance extends Playable
}
// LCoin UI update.
if (item.getId() == ExBloodyCoinCount.LCOIN_ID)
if (item.getId() == Inventory.LCOIN_ID)
{
sendPacket(new ExBloodyCoinCount(this));
}
@@ -6731,6 +6734,8 @@ public class PlayerInstance extends Playable
player.restoreFriendList();
player.restoreRandomCraft();
player.loadRecommendations();
player.startRecoGiveTask();
player.startOnlineTimeUpdateTask();
@@ -7029,6 +7034,11 @@ public class PlayerInstance extends Playable
}
}
}
if (_randomCraft != null)
{
_randomCraft.store();
}
}
@Override
@@ -14422,4 +14432,15 @@ public class PlayerInstance extends Playable
}
return 0;
}
private void restoreRandomCraft()
{
_randomCraft = new PlayerRandomCraft(this);
_randomCraft.restore();
}
public PlayerRandomCraft getRandomCraft()
{
return _randomCraft;
}
}

View File

@@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RandomCraftRequest extends AbstractRequest
{
public RandomCraftRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@@ -0,0 +1,42 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.holders;
/**
* @author Mobius
*/
public class RandomCraftExtractDataHolder
{
private final long _points;
private final long _fee;
public RandomCraftExtractDataHolder(long points, long fee)
{
_points = points;
_fee = fee;
}
public long getPoints()
{
return _points;
}
public long getFee()
{
return _fee;
}
}

View File

@@ -0,0 +1,56 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.holders;
/**
* @author Mode
*/
public class RandomCraftRewardDataHolder
{
private final int _itemId;
private final long _count;
private final double _chance;
private final boolean _announce;
public RandomCraftRewardDataHolder(int itemId, long count, double chance, boolean announce)
{
_itemId = itemId;
_count = count;
_chance = chance;
_announce = announce;
}
public int getItemId()
{
return _itemId;
}
public long getCount()
{
return _count;
}
public double getChance()
{
return _chance;
}
public boolean isAnnounce()
{
return _announce;
}
}

View File

@@ -0,0 +1,70 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.holders;
/**
* @author Mode
*/
public class RandomCraftRewardItemHolder
{
private final int _id;
private final long _count;
private boolean _locked;
private int _lockLeft;
public RandomCraftRewardItemHolder(int id, long count, boolean locked, int lockLeft)
{
_id = id;
_count = count;
_locked = locked;
_lockLeft = lockLeft;
}
public int getItemId()
{
return _id;
}
public long getItemCount()
{
return _count;
}
public boolean isLocked()
{
return _locked;
}
public int getLockLeft()
{
return _lockLeft;
}
public void lock()
{
_locked = true;
}
public void decLock()
{
_lockLeft--;
if (_lockLeft <= 0)
{
_locked = false;
}
}
}

View File

@@ -88,7 +88,7 @@ public abstract class Inventory extends ItemContainer
public static final int AIR_STONE_ID = 39461;
public static final int TEMPEST_STONE_ID = 39592;
public static final int ELCYUM_CRYSTAL_ID = 36514;
public static final int LCOIN_ID = 91663;
public static final long MAX_ADENA = Config.MAX_ADENA;
public static final int PAPERDOLL_UNDER = 0;

View File

@@ -478,7 +478,7 @@ public class PlayerInventory extends Inventory
}
// LCoin UI update.
if (item.getId() == ExBloodyCoinCount.LCOIN_ID)
if (item.getId() == Inventory.LCOIN_ID)
{
actor.sendPacket(new ExBloodyCoinCount(actor));
}

View File

@@ -0,0 +1,355 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.itemcontainer;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.data.xml.RandomCraftData;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RandomCraftRequest;
import org.l2jmobius.gameserver.model.holders.RandomCraftRewardItemHolder;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ExItemAnnounce;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.randomcraft.ExCraftInfo;
import org.l2jmobius.gameserver.network.serverpackets.randomcraft.ExCraftRandomInfo;
import org.l2jmobius.gameserver.network.serverpackets.randomcraft.ExCraftRandomMake;
import org.l2jmobius.gameserver.network.serverpackets.randomcraft.ExCraftRandomRefresh;
import org.l2jmobius.gameserver.util.Broadcast;
/**
* @author Mode
*/
public class PlayerRandomCraft
{
private static final Logger LOGGER = Logger.getLogger(PlayerRandomCraft.class.getName());
public static final int MAX_FULL_CRAFT_POINTS = 99;
public static final int MAX_CRAFT_POINTS = 1000000;
private final PlayerInstance _player;
private final List<RandomCraftRewardItemHolder> _rewardList = new ArrayList<>(5);
private int _fullCraftPoints = 0;
private int _craftPoints = 0;
private boolean _isSayhaRoll = false;
public PlayerRandomCraft(PlayerInstance player)
{
_player = player;
}
public void restore()
{
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_random_craft WHERE charId=?"))
{
ps.setInt(1, _player.getObjectId());
try (ResultSet rs = ps.executeQuery())
{
if (rs.next())
{
try
{
_fullCraftPoints = rs.getInt("random_craft_full_points");
_craftPoints = rs.getInt("random_craft_points");
_isSayhaRoll = rs.getBoolean("sayha_roll");
for (int i = 1; i <= 5; i++)
{
final int itemId = rs.getInt("item_" + i + "_id");
final long itemCount = rs.getLong("item_" + i + "_count");
final boolean itemLocked = rs.getBoolean("item_" + i + "_locked");
final int itemLockLeft = rs.getInt("item_" + i + "_lock_left");
final RandomCraftRewardItemHolder holder = new RandomCraftRewardItemHolder(itemId, itemCount, itemLocked, itemLockLeft);
_rewardList.add(i - 1, holder);
}
}
catch (Exception e)
{
LOGGER.warning("Could not restore random craft for " + _player);
}
}
else
{
storeNew();
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Could not restore random craft for " + _player, e);
}
}
public void store()
{
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE character_random_craft SET random_craft_full_points=?,random_craft_points=?,sayha_roll=?,item_1_id=?,item_1_count=?,item_1_locked=?,item_1_lock_left=?,item_2_id=?,item_2_count=?,item_2_locked=?,item_2_lock_left=?,item_3_id=?,item_3_count=?,item_3_locked=?,item_3_lock_left=?,item_4_id=?,item_4_count=?,item_4_locked=?,item_4_lock_left=?,item_5_id=?,item_5_count=?,item_5_locked=?,item_5_lock_left=?"))
{
ps.setInt(1, _fullCraftPoints);
ps.setInt(2, _craftPoints);
ps.setBoolean(3, _isSayhaRoll);
for (int i = 0; i < 5; i++)
{
if (_rewardList.size() >= (i + 1))
{
final RandomCraftRewardItemHolder holder = _rewardList.get(i);
ps.setInt(4 + (i * 4), holder == null ? 0 : holder.getItemId());
ps.setLong(5 + (i * 4), holder == null ? 0 : holder.getItemCount());
ps.setBoolean(6 + (i * 4), holder == null ? false : holder.isLocked());
ps.setInt(7 + (i * 4), holder == null ? 20 : holder.getLockLeft());
}
else
{
ps.setInt(4 + (i * 4), 0);
ps.setLong(5 + (i * 4), 0);
ps.setBoolean(6 + (i * 4), false);
ps.setInt(7 + (i * 4), 20);
}
}
ps.execute();
}
catch (Exception e)
{
LOGGER.log(Level.SEVERE, "Could not store RandomCraft for: " + _player, e);
}
}
public void storeNew()
{
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO character_random_craft VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _player.getObjectId());
ps.setInt(2, _fullCraftPoints);
ps.setInt(3, _craftPoints);
ps.setBoolean(4, _isSayhaRoll);
for (int i = 0; i < 5; i++)
{
ps.setInt(5 + (i * 4), 0);
ps.setLong(6 + (i * 4), 0);
ps.setBoolean(7 + (i * 4), false);
ps.setInt(8 + (i * 4), 0);
}
ps.executeUpdate();
}
catch (Exception e)
{
LOGGER.log(Level.SEVERE, "Could not store new RandomCraft for: " + _player, e.getMessage());
}
}
public void refresh()
{
if (_player.hasItemRequest() || _player.hasRequest(RandomCraftRequest.class))
{
return;
}
_player.addRequest(new RandomCraftRequest(_player));
if ((_fullCraftPoints > 0) && _player.reduceAdena("RandomCraft Refresh", 10000, _player, true))
{
_player.sendPacket(new ExCraftInfo(_player));
_player.sendPacket(new ExCraftRandomRefresh());
_fullCraftPoints--;
if (_isSayhaRoll)
{
_player.addItem("RandomCraft Roll", 91641, 2, _player, true);
_isSayhaRoll = false;
}
_player.sendPacket(new ExCraftInfo(_player));
for (int i = 0; i < 5; i++)
{
final RandomCraftRewardItemHolder holder;
if (i > (_rewardList.size() - 1))
{
holder = null;
}
else
{
holder = _rewardList.get(i);
}
if (holder == null)
{
_rewardList.add(i, getNewReward());
}
else if (!holder.isLocked())
{
_rewardList.set(i, getNewReward());
}
else
{
holder.decLock();
}
}
_player.sendPacket(new ExCraftRandomInfo(_player));
}
_player.removeRequest(RandomCraftRequest.class);
}
private RandomCraftRewardItemHolder getNewReward()
{
if (RandomCraftData.getInstance().isEmpty())
{
return null;
}
RandomCraftRewardItemHolder result = null;
while (result == null)
{
result = RandomCraftData.getInstance().getNewReward();
SEARCH: for (RandomCraftRewardItemHolder reward : _rewardList)
{
if (reward.getItemId() == result.getItemId())
{
result = null;
break SEARCH;
}
}
}
return result;
}
public void make()
{
if (_player.hasItemRequest() || _player.hasRequest(RandomCraftRequest.class))
{
return;
}
_player.addRequest(new RandomCraftRequest(_player));
if (_player.reduceAdena("RandomCraft Make", 500000, _player, true))
{
final int madeId = Rnd.get(0, 4);
final RandomCraftRewardItemHolder holder = _rewardList.get(madeId);
final int itemId = holder.getItemId();
final long itemCount = holder.getItemCount();
_rewardList.clear();
final ItemInstance item = _player.addItem("RandomCraft Make", itemId, itemCount, _player, true);
if (RandomCraftData.getInstance().isAnnounce(itemId))
{
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(_player, item, ExItemAnnounce.RANDOM_CRAFT));
LOGGER.log(Level.INFO, _player + " randomly crafted " + item.getItem() + " [" + item.getObjectId() + "]");
}
_player.sendPacket(new ExCraftRandomMake(itemId, itemCount));
_player.sendPacket(new ExCraftRandomInfo(_player));
}
_player.removeRequest(RandomCraftRequest.class);
}
public List<RandomCraftRewardItemHolder> getRewards()
{
return _rewardList;
}
public int getFullCraftPoints()
{
return _fullCraftPoints;
}
public void addFullCraftPoints(int value)
{
addFullCraftPoints(value, false);
}
public void addFullCraftPoints(int value, boolean broadcast)
{
_fullCraftPoints = Math.min(_fullCraftPoints + value, MAX_FULL_CRAFT_POINTS);
if (_craftPoints >= MAX_CRAFT_POINTS)
{
_craftPoints = 0;
}
if (value > 0)
{
_isSayhaRoll = true;
}
if (broadcast)
{
_player.sendPacket(new ExCraftInfo(_player));
}
}
public void removeFullCraftPoints(int value)
{
_fullCraftPoints -= value;
_player.sendPacket(new ExCraftInfo(_player));
}
public void addCraftPoints(int value)
{
if ((_craftPoints - 1) < MAX_CRAFT_POINTS)
{
_craftPoints += value;
}
final int fullPointsToAdd = _craftPoints / MAX_CRAFT_POINTS;
final int pointsToRemove = MAX_CRAFT_POINTS * fullPointsToAdd;
_craftPoints -= pointsToRemove;
addFullCraftPoints(fullPointsToAdd);
if (_fullCraftPoints == MAX_FULL_CRAFT_POINTS)
{
_craftPoints = MAX_CRAFT_POINTS;
}
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_ACQUIRED_S1_CRAFT_SCALE_POINTS);
sm.addLong(value);
_player.sendPacket(sm);
_player.sendPacket(new ExCraftInfo(_player));
}
public int getCraftPoints()
{
return _craftPoints;
}
public void setIsSayhaRoll(boolean value)
{
_isSayhaRoll = value;
}
public boolean isSayhaRoll()
{
return _isSayhaRoll;
}
public int getLockedSlotCount()
{
int count = 0;
for (RandomCraftRewardItemHolder holder : _rewardList)
{
if (holder.isLocked())
{
count++;
}
}
return count;
}
}

View File

@@ -99,6 +99,11 @@ import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRProduct
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRRecentProductList;
import org.l2jmobius.gameserver.network.clientpackets.raidbossinfo.RequestRaidBossSpawnInfo;
import org.l2jmobius.gameserver.network.clientpackets.raidbossinfo.RequestRaidServerInfo;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftExtract;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftInfo;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftLockSlot;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftMake;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftRefresh;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadHeroAndLegendInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadMyRankingInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadRankingInfo;
@@ -535,11 +540,11 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_CASTLEWAR_OBSERVER_START(0x196, null, ConnectionState.IN_GAME),
EX_RAID_TELEPORT_INFO(0x197, null, ConnectionState.IN_GAME),
EX_TELEPORT_TO_RAID_POSITION(0x198, null, ConnectionState.IN_GAME),
EX_CRAFT_EXTRACT(0x199, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_INFO(0x19A, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_LOCK_SLOTEX_CRAFT_RANDOM_INFO(0x19B, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_REFRESH(0x19C, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_MAKE(0x19D, null, ConnectionState.IN_GAME),
EX_CRAFT_EXTRACT(0x199, ExRequestRandomCraftExtract::new, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_INFO(0x19A, ExRequestRandomCraftInfo::new, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_LOCK_SLOTEX_CRAFT_RANDOM_INFO(0x19B, ExRequestRandomCraftLockSlot::new, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_REFRESH(0x19C, ExRequestRandomCraftRefresh::new, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_MAKE(0x19D, ExRequestRandomCraftMake::new, ConnectionState.IN_GAME),
EX_MULTI_SELL_LIST(0x19E, null, ConnectionState.IN_GAME),
EX_SAVE_ITEM_ANNOUNCE_SETTING(0x19F, null, ConnectionState.IN_GAME),
EX_OLYMPIAD_UI(0x1A0, null, ConnectionState.IN_GAME),

View File

@@ -109,6 +109,7 @@ import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayRecei
import org.l2jmobius.gameserver.network.serverpackets.friend.L2FriendList;
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExBloodyCoinCount;
import org.l2jmobius.gameserver.network.serverpackets.magiclamp.ExMagicLampExpInfoUI;
import org.l2jmobius.gameserver.network.serverpackets.randomcraft.ExCraftInfo;
import org.l2jmobius.gameserver.util.BuilderUtil;
/**
@@ -633,11 +634,6 @@ public class EnterWorld implements IClientIncomingPacket
player.sendPacket(new ExConnectedTimeAndGettableReward(player));
player.sendPacket(new ExOneDayReceiveRewardList(player, true));
if (Config.MAGIC_LAMP_ENABLE)
{
player.sendPacket(new ExMagicLampExpInfoUI(player));
}
// Handle soulshots, disable all on EnterWorld
player.sendPacket(new ExAutoSoulShot(0, true, 0));
player.sendPacket(new ExAutoSoulShot(0, true, 1));
@@ -664,6 +660,16 @@ public class EnterWorld implements IClientIncomingPacket
player.sendPacket(new ExVitalityEffectInfo(player));
}
if (Config.ENABLE_MAGIC_LAMP)
{
player.sendPacket(new ExMagicLampExpInfoUI(player));
}
if (Config.ENABLE_RANDOM_CRAFT)
{
player.sendPacket(new ExCraftInfo(player));
}
// Activate first agathion when available.
final ItemInstance agathion = player.getInventory().unEquipItemInBodySlot(Item.SLOT_AGATHION);
if (agathion != null)

View File

@@ -31,6 +31,7 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
@@ -228,7 +229,7 @@ public class RequestDestroyItem implements IClientIncomingPacket
}
// LCoin UI update.
if (removedItem.getId() == ExBloodyCoinCount.LCOIN_ID)
if (removedItem.getId() == Inventory.LCOIN_ID)
{
player.sendPacket(new ExBloodyCoinCount(player));
}

View File

@@ -234,7 +234,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
sm.addInt(item.getEnchantLevel());
sm.addItemName(item);
player.broadcastPacket(sm);
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(item, player));
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.ENCHANT));
final Skill skill = CommonSkill.FIREWORK.getSkill();
if (skill != null)

View File

@@ -0,0 +1,109 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.randomcraft;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.RandomCraftData;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RandomCraftRequest;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.randomcraft.ExCraftExtract;
import org.l2jmobius.gameserver.network.serverpackets.randomcraft.ExCraftInfo;
/**
* @author Mode
*/
public class ExRequestRandomCraftExtract implements IClientIncomingPacket
{
private final Map<Integer, Long> _items = new HashMap<>();
@Override
public boolean read(GameClient client, PacketReader packet)
{
final int size = packet.readD();
for (int i = 0; i < size; i++)
{
final int objId = packet.readD();
final long count = packet.readQ();
_items.put(objId, count);
}
return true;
}
@Override
public void run(GameClient client)
{
if (!Config.ENABLE_RANDOM_CRAFT)
{
return;
}
final PlayerInstance player = client.getPlayer();
if (player == null)
{
return;
}
if (player.hasItemRequest() || player.hasRequest(RandomCraftRequest.class))
{
return;
}
player.addRequest(new RandomCraftRequest(player));
int points = 0;
int fee = 0;
Map<Integer, Long> toDestroy = new HashMap<>();
for (Entry<Integer, Long> e : _items.entrySet())
{
final int objId = e.getKey();
long count = e.getValue();
if (count < 1)
{
player.removeRequest(RandomCraftRequest.class);
return;
}
final ItemInstance item = player.getInventory().getItemByObjectId(objId);
if (item != null)
{
count = Math.min(item.getCount(), count);
toDestroy.put(objId, count);
points += RandomCraftData.getInstance().getPoints(item.getId()) * count;
fee += RandomCraftData.getInstance().getFee(item.getId()) * count;
}
}
if (player.reduceAdena("RandomCraft Extract", fee, player, true))
{
for (Entry<Integer, Long> e : toDestroy.entrySet())
{
player.destroyItem("RandomCraft Extract", e.getKey(), e.getValue(), player, true);
}
player.getRandomCraft().addCraftPoints(points);
}
player.sendPacket(new ExCraftInfo(player));
player.sendPacket(new ExCraftExtract());
player.removeRequest(RandomCraftRequest.class);
}
}

View File

@@ -0,0 +1,53 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.randomcraft;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.randomcraft.ExCraftRandomInfo;
/**
* @author Mode
*/
public class ExRequestRandomCraftInfo implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
if (!Config.ENABLE_RANDOM_CRAFT)
{
return;
}
final PlayerInstance player = client.getPlayer();
if (player == null)
{
return;
}
player.sendPacket(new ExCraftRandomInfo(player));
}
}

View File

@@ -0,0 +1,83 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.randomcraft;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.itemcontainer.PlayerRandomCraft;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.randomcraft.ExCraftRandomInfo;
import org.l2jmobius.gameserver.network.serverpackets.randomcraft.ExCraftRandomLockSlot;
/**
* @author Mode
*/
public class ExRequestRandomCraftLockSlot implements IClientIncomingPacket
{
private static final int[] LOCK_PRICE =
{
100,
500,
1000
};
private int _id;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_id = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
if (!Config.ENABLE_RANDOM_CRAFT)
{
return;
}
final PlayerInstance player = client.getPlayer();
if (player == null)
{
return;
}
if ((_id >= 0) && (_id < 5))
{
final PlayerRandomCraft rc = player.getRandomCraft();
int lockedItemCount = rc.getLockedSlotCount();
if (((rc.getRewards().size() - 1) >= _id) && (lockedItemCount < 3))
{
int price = LOCK_PRICE[Math.min(lockedItemCount, 2)];
ItemInstance lcoin = player.getInventory().getItemByItemId(Inventory.LCOIN_ID);
if ((lcoin != null) && (lcoin.getCount() >= price))
{
player.destroyItem("RandomCraft Lock Slot", lcoin, price, player, true);
rc.getRewards().get(_id).lock();
player.sendPacket(new ExCraftRandomLockSlot());
player.sendPacket(new ExCraftRandomInfo(player));
}
}
}
}
}

View File

@@ -0,0 +1,54 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.randomcraft;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.itemcontainer.PlayerRandomCraft;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/**
* @author Mode
*/
public class ExRequestRandomCraftMake implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
if (!Config.ENABLE_RANDOM_CRAFT)
{
return;
}
final PlayerInstance player = client.getPlayer();
if (player == null)
{
return;
}
final PlayerRandomCraft rc = player.getRandomCraft();
rc.make();
}
}

View File

@@ -0,0 +1,54 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.randomcraft;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.itemcontainer.PlayerRandomCraft;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/**
* @author Mode
*/
public class ExRequestRandomCraftRefresh implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
if (!Config.ENABLE_RANDOM_CRAFT)
{
return;
}
final PlayerInstance player = client.getPlayer();
if (player == null)
{
return;
}
final PlayerRandomCraft rc = player.getRandomCraft();
rc.refresh();
}
}

View File

@@ -22,24 +22,29 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
/**
* @author NviX
* @author NviX, Mobius
*/
public class ExItemAnnounce implements IClientOutgoingPacket
{
public static final int ENCHANT = 0x00;
public static final int RANDOM_CRAFT = 0x02;
private final ItemInstance _item;
private final PlayerInstance _player;
private final int _type;
public ExItemAnnounce(ItemInstance item, PlayerInstance player)
public ExItemAnnounce(PlayerInstance player, ItemInstance item, int type)
{
_item = item;
_player = player;
_item = item;
_type = type;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_ITEM_ANNOUNCE.writeId(packet);
packet.writeC(0x00); // item icon
packet.writeC(_type); // announce type
packet.writeString(_player.getName()); // name of player
packet.writeD(_item.getId()); // item id
packet.writeD(_item.getEnchantLevel()); // enchant level

View File

@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets.limitshop;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
@@ -26,13 +27,11 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
*/
public class ExBloodyCoinCount implements IClientOutgoingPacket
{
public final static int LCOIN_ID = 91663;
private final long _count;
public ExBloodyCoinCount(PlayerInstance player)
{
_count = player.getInventory().getInventoryItemCount(LCOIN_ID, -1);
_count = player.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1);
}
@Override

View File

@@ -38,7 +38,7 @@ public class ExMagicLampExpInfoUI implements IClientOutgoingPacket
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_MAGICLAMP_EXP_INFO.writeId(packet);
packet.writeD(Config.MAGIC_LAMP_ENABLE ? 0x01 : 0x00); // IsOpen
packet.writeD(Config.ENABLE_MAGIC_LAMP ? 0x01 : 0x00); // IsOpen
packet.writeD(Config.MAGIC_LAMP_MAX_LEVEL_EXP); // MaxMagicLampExp
packet.writeD(_player.getLampExp()); // MagicLampExp
packet.writeD(_player.getLampCount()); // MagicLampCount

View File

@@ -0,0 +1,39 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.randomcraft;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Mode
*/
public class ExCraftExtract implements IClientOutgoingPacket
{
public ExCraftExtract()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_CRAFT_EXTRACT.writeId(packet);
packet.writeC(0x00);
return true;
}
}

View File

@@ -0,0 +1,49 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.randomcraft;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.itemcontainer.PlayerRandomCraft;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Mode
*/
public class ExCraftInfo implements IClientOutgoingPacket
{
private final PlayerInstance _player;
public ExCraftInfo(PlayerInstance player)
{
_player = player;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_CRAFT_INFO.writeId(packet);
final PlayerRandomCraft rc = _player.getRandomCraft();
packet.writeD(rc.getFullCraftPoints()); // Full points owned
packet.writeD(rc.getCraftPoints()); // Craft Points (10k = 1%)
packet.writeC(rc.isSayhaRoll() ? 0x01 : 0x00); // Will get sayha?
return true;
}
}

View File

@@ -0,0 +1,78 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.randomcraft;
import java.util.List;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.holders.RandomCraftRewardItemHolder;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Mode
*/
public class ExCraftRandomInfo implements IClientOutgoingPacket
{
private final PlayerInstance _player;
public ExCraftRandomInfo(PlayerInstance player)
{
_player = player;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_CRAFT_RANDOM_INFO.writeId(packet);
final List<RandomCraftRewardItemHolder> rewards = _player.getRandomCraft().getRewards();
int size = 5;
packet.writeD(size); // size
for (int i = 0; i < rewards.size(); i++)
{
final RandomCraftRewardItemHolder holder = rewards.get(i);
if ((holder != null) && (holder.getItemId() != 0))
{
packet.writeC(holder.isLocked() ? 0x01 : 0x00); // Locked
packet.writeD(holder.getLockLeft()); // Rolls it will stay locked
packet.writeD(holder.getItemId()); // Item id
packet.writeQ(holder.getItemCount()); // Item count
}
else
{
packet.writeC(0x00);
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeQ(0x00);
}
size--;
}
// Write missing
for (int i = size; i > 0; i--)
{
packet.writeC(0x00);
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeQ(0x00);
}
return true;
}
}

View File

@@ -0,0 +1,39 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.randomcraft;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Mode
*/
public class ExCraftRandomLockSlot implements IClientOutgoingPacket
{
public ExCraftRandomLockSlot()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_CRAFT_RANDOM_LOCK_SLOT.writeId(packet);
packet.writeC(0x00);
return true;
}
}

View File

@@ -0,0 +1,48 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.randomcraft;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Mode
*/
public class ExCraftRandomMake implements IClientOutgoingPacket
{
private final int _itemId;
private final long _itemCount;
public ExCraftRandomMake(int itemId, long itemCount)
{
_itemId = itemId;
_itemCount = itemCount;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_CRAFT_RANDOM_MAKE.writeId(packet);
packet.writeC(0x00); // Close window
packet.writeH(0x0F); // Unknown
packet.writeD(_itemId);
packet.writeQ(_itemCount);
packet.writeC(0x00); // Enchantment level
return true;
}
}

View File

@@ -0,0 +1,39 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.randomcraft;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Mode
*/
public class ExCraftRandomRefresh implements IClientOutgoingPacket
{
public ExCraftRandomRefresh()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_CRAFT_RANDOM_REFRESH.writeId(packet);
packet.writeC(0x00);
return true;
}
}

View File

@@ -107,7 +107,13 @@ The Kamael: https://eu.4game.com/patchnotes/lineage2classic/154/
Death Knight: https://eu.4game.com/patchnotes/lineage2essence/196/
-Death Knight creation support
-Death knight starting area
-Death knight quests
-Player bonus stats system
-LCoin shop system
-Sayha's Grace system
-Random Craft system
-Magic Lamp system
Fluffy Reinforcement: https://eu.4game.com/patchnotes/lineage2essence/204/
-Teleport favorites system