Implemented pet ranking.

This commit is contained in:
MobiusDevelopment
2022-10-19 21:16:56 +00:00
parent 525f7e018a
commit 9be9578a5e
22 changed files with 778 additions and 614 deletions

View File

@@ -1,7 +1,7 @@
DROP TABLE IF EXISTS `pets`; DROP TABLE IF EXISTS `pets`;
CREATE TABLE IF NOT EXISTS `pets` ( CREATE TABLE IF NOT EXISTS `pets` (
`item_obj_id` int(10) unsigned NOT NULL, `item_obj_id` int(10) unsigned NOT NULL,
`name` varchar(16), `name` varchar(36),
`level` smallint(2) unsigned NOT NULL, `level` smallint(2) unsigned NOT NULL,
`curHp` int(9) unsigned DEFAULT '0', `curHp` int(9) unsigned DEFAULT '0',
`curMp` int(9) unsigned DEFAULT '0', `curMp` int(9) unsigned DEFAULT '0',

View File

@@ -1,171 +1,171 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/PetTypes.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/PetTypes.xsd">
<pet id="1" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 1 --> <pet id="1" name="Wolf's Secret 1" />
<pet id="2" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 2 --> <pet id="2" name="Wolf's Secret 2" />
<pet id="3" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 3 --> <pet id="3" name="Wolf's Secret 3" />
<pet id="4" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 4 --> <pet id="4" name="Wolf's Secret 4" />
<pet id="5" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 5 --> <pet id="5" name="Wolf's Secret 5" />
<pet id="6" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 6 --> <pet id="6" name="Wolf's Secret 6" />
<pet id="7" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 7 --> <pet id="7" name="Wolf's Secret 7" />
<pet id="8" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 8 --> <pet id="8" name="Wolf's Secret 8" />
<pet id="9" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 9 --> <pet id="9" name="Wolf's Secret 9" />
<pet id="10" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 10 --> <pet id="10" name="Wolf's Secret 10" />
<pet id="11" skillId="49201" skillLvl="1" /> <!-- Strong : STR +1 --> <pet id="11" name="Strong" skillId="49201" skillLvl="1" />
<pet id="12" skillId="49201" skillLvl="2" /> <!-- Mighty : STR +2 --> <pet id="12" name="Mighty" skillId="49201" skillLvl="2" />
<pet id="13" skillId="49201" skillLvl="3" /> <!-- Powerful : STR +3 --> <pet id="13" name="Powerful" skillId="49201" skillLvl="3" />
<pet id="14" skillId="49202" skillLvl="1" /> <!-- Swift : DEX +1 --> <pet id="14" name="Swift" skillId="49202" skillLvl="1" />
<pet id="15" skillId="49202" skillLvl="2" /> <!-- Quick : DEX +2 --> <pet id="15" name="Quick" skillId="49202" skillLvl="2" />
<pet id="16" skillId="49202" skillLvl="3" /> <!-- Dexterous : DEX +3 --> <pet id="16" name="Dexterous" skillId="49202" skillLvl="3" />
<pet id="17" skillId="49203" skillLvl="1" /> <!-- Healthy : CON +1 --> <pet id="17" name="Healthy" skillId="49203" skillLvl="1" />
<pet id="18" skillId="49203" skillLvl="2" /> <!-- Enduring : CON +2 --> <pet id="18" name="Enduring" skillId="49203" skillLvl="2" />
<pet id="19" skillId="49203" skillLvl="3" /> <!-- Tough : CON +3 --> <pet id="19" name="Tough" skillId="49203" skillLvl="3" />
<pet id="20" skillId="49204" skillLvl="1" /> <!-- Clever : INT +1 --> <pet id="20" name="Clever" skillId="49204" skillLvl="1" />
<pet id="21" skillId="49204" skillLvl="2" /> <!-- Smart : INT +2 --> <pet id="21" name="Smart" skillId="49204" skillLvl="2" />
<pet id="22" skillId="49204" skillLvl="3" /> <!-- Intelligent : INT +3 --> <pet id="22" name="Intelligent" skillId="49204" skillLvl="3" />
<pet id="23" skillId="49205" skillLvl="1" /> <!-- Sharp : WIT +1 --> <pet id="23" name="Sharp" skillId="49205" skillLvl="1" />
<pet id="24" skillId="49205" skillLvl="2" /> <!-- Wise : WIT +2 --> <pet id="24" name="Wise" skillId="49205" skillLvl="2" />
<pet id="25" skillId="49205" skillLvl="3" /> <!-- Insightful : WIT +3 --> <pet id="25" name="Insightful" skillId="49205" skillLvl="3" />
<pet id="26" skillId="49206" skillLvl="1" /> <!-- Vigorous : MEN +1 --> <pet id="26" name="Vigorous" skillId="49206" skillLvl="1" />
<pet id="27" skillId="49206" skillLvl="2" /> <!-- Resolute : MEN +2 --> <pet id="27" name="Resolute" skillId="49206" skillLvl="2" />
<pet id="28" skillId="49206" skillLvl="3" /> <!-- Strong-spirited : MEN +3 --> <pet id="28" name="Strong-spirited" skillId="49206" skillLvl="3" />
<pet id="29" skillId="0" skillLvl="0" /> <!-- Wolf : Common pet --> <pet id="29" name="Wolf" />
<pet id="30" skillId="0" skillLvl="0" /> <!-- Buffalo : Calf --> <pet id="30" name="Buffalo" />
<pet id="31" skillId="0" skillLvl="0" /> <!-- Tiger : Mature --> <pet id="31" name="Tiger" />
<pet id="32" skillId="0" skillLvl="0" /> <!-- Kookaburra : Ostrich relative --> <pet id="32" name="Kookaburra" />
<pet id="33" skillId="0" skillLvl="0" /> <!-- Dragon : No fire breath --> <pet id="33" name="Dragon" />
<pet id="34" skillId="0" skillLvl="0" /> <!-- Thunder Hawk : New species --> <pet id="34" name="Thunder Hawk" />
<pet id="101" skillId="0" skillLvl="0" /> <!-- Woof-woof --> <pet id="101" name="Woof-woof" />
<pet id="102" skillId="0" skillLvl="0" /> <!-- Silver Hide --> <pet id="102" name="Silver Hide" />
<pet id="103" skillId="0" skillLvl="0" /> <!-- Chun --> <pet id="103" name="Chun" />
<pet id="104" skillId="0" skillLvl="0" /> <!-- Watchdog --> <pet id="104" name="Watchdog" />
<pet id="105" skillId="0" skillLvl="0" /> <!-- Red Eye --> <pet id="105" name="Red Eye" />
<pet id="106" skillId="0" skillLvl="0" /> <!-- Robo --> <pet id="106" name="Robo" />
<pet id="107" skillId="0" skillLvl="0" /> <!-- Shepherd --> <pet id="107" name="Shepherd" />
<pet id="108" skillId="0" skillLvl="0" /> <!-- Hindo --> <pet id="108" name="Hindo" />
<pet id="109" skillId="0" skillLvl="0" /> <!-- Mary --> <pet id="109" name="Mary" />
<pet id="110" skillId="0" skillLvl="0" /> <!-- Cu Chulainn --> <pet id="110" name="Cu Chulainn" />
<pet id="111" skillId="0" skillLvl="0" /> <!-- Cu Chulainn --> <pet id="111" name="Cu Chulainn" />
<pet id="112" skillId="0" skillLvl="0" /> <!-- Robo --> <pet id="112" name="Robo" />
<pet id="113" skillId="0" skillLvl="0" /> <!-- Romulus --> <pet id="113" name="Romulus" />
<pet id="114" skillId="0" skillLvl="0" /> <!-- Phenyl --> <pet id="114" name="Phenyl" />
<pet id="115" skillId="0" skillLvl="0" /> <!-- Allen --> <pet id="115" name="Allen" />
<pet id="116" skillId="0" skillLvl="0" /> <!-- Alexander --> <pet id="116" name="Alexander" />
<pet id="117" skillId="0" skillLvl="0" /> <!-- Cardiff Wolf --> <pet id="117" name="Cardiff Wolf" />
<pet id="118" skillId="0" skillLvl="0" /> <!-- Werewolf --> <pet id="118" name="Werewolf" />
<pet id="119" skillId="0" skillLvl="0" /> <!-- Garum Wolf --> <pet id="119" name="Garum Wolf" />
<pet id="120" skillId="0" skillLvl="0" /> <!-- Kasha Wolf --> <pet id="120" name="Kasha Wolf" />
<pet id="121" skillId="0" skillLvl="0" /> <!-- Kerope Wolf --> <pet id="121" name="Kerope Wolf" />
<pet id="122" skillId="0" skillLvl="0" /> <!-- Chanlan --> <pet id="122" name="Chanlan" />
<pet id="123" skillId="0" skillLvl="0" /> <!-- Lupine King --> <pet id="123" name="Lupine King" />
<pet id="124" skillId="0" skillLvl="0" /> <!-- Forest Hunter --> <pet id="124" name="Forest Hunter" />
<pet id="125" skillId="0" skillLvl="0" /> <!-- Blue Wolf --> <pet id="125" name="Blue Wolf" />
<pet id="126" skillId="0" skillLvl="0" /> <!-- Limonite --> <pet id="126" name="Limonite" />
<pet id="127" skillId="0" skillLvl="0" /> <!-- Minota --> <pet id="127" name="Minota" />
<pet id="128" skillId="0" skillLvl="0" /> <!-- Minota --> <pet id="128" name="Minota" />
<pet id="129" skillId="0" skillLvl="0" /> <!-- Thick Skull --> <pet id="129" name="Thick Skull" />
<pet id="130" skillId="0" skillLvl="0" /> <!-- Cattle King --> <pet id="130" name="Cattle King" />
<pet id="131" skillId="0" skillLvl="0" /> <!-- Bison --> <pet id="131" name="Bison" />
<pet id="132" skillId="0" skillLvl="0" /> <!-- Auroch --> <pet id="132" name="Auroch" />
<pet id="133" skillId="0" skillLvl="0" /> <!-- Bison --> <pet id="133" name="Bison" />
<pet id="134" skillId="0" skillLvl="0" /> <!-- Apis --> <pet id="134" name="Apis" />
<pet id="135" skillId="0" skillLvl="0" /> <!-- Charles --> <pet id="135" name="Charles" />
<pet id="136" skillId="0" skillLvl="0" /> <!-- Denver --> <pet id="136" name="Denver" />
<pet id="137" skillId="0" skillLvl="0" /> <!-- Mathorn --> <pet id="137" name="Mathorn" />
<pet id="138" skillId="0" skillLvl="0" /> <!-- Desert Rogue --> <pet id="138" name="Desert Rogue" />
<pet id="139" skillId="0" skillLvl="0" /> <!-- Puss --> <pet id="139" name="Puss" />
<pet id="140" skillId="0" skillLvl="0" /> <!-- Tigger --> <pet id="140" name="Tigger" />
<pet id="141" skillId="0" skillLvl="0" /> <!-- Moggy --> <pet id="141" name="Moggy" />
<pet id="142" skillId="0" skillLvl="0" /> <!-- Kitty --> <pet id="142" name="Kitty" />
<pet id="143" skillId="0" skillLvl="0" /> <!-- Amos --> <pet id="143" name="Amos" />
<pet id="144" skillId="0" skillLvl="0" /> <!-- Sel Mahum --> <pet id="144" name="Sel Mahum" />
<pet id="145" skillId="0" skillLvl="0" /> <!-- Irene --> <pet id="145" name="Irene" />
<pet id="146" skillId="0" skillLvl="0" /> <!-- Marillia --> <pet id="146" name="Marillia" />
<pet id="147" skillId="0" skillLvl="0" /> <!-- Changun --> <pet id="147" name="Changun" />
<pet id="148" skillId="0" skillLvl="0" /> <!-- Dreadful Hunter --> <pet id="148" name="Dreadful Hunter" />
<pet id="149" skillId="0" skillLvl="0" /> <!-- Forest Ghost --> <pet id="149" name="Forest Ghost" />
<pet id="150" skillId="0" skillLvl="0" /> <!-- Beast King --> <pet id="150" name="Beast King" />
<pet id="151" skillId="0" skillLvl="0" /> <!-- Dark Assassin --> <pet id="151" name="Dark Assassin" />
<pet id="152" skillId="0" skillLvl="0" /> <!-- Master of the Jungle --> <pet id="152" name="Master of the Jungle" />
<pet id="153" skillId="0" skillLvl="0" /> <!-- Hatchling --> <pet id="153" name="Hatchling" />
<pet id="154" skillId="0" skillLvl="0" /> <!-- Fafnir --> <pet id="154" name="Fafnir" />
<pet id="155" skillId="0" skillLvl="0" /> <!-- Quetzalcoatl --> <pet id="155" name="Quetzalcoatl" />
<pet id="156" skillId="0" skillLvl="0" /> <!-- Fafnir --> <pet id="156" name="Fafnir" />
<pet id="157" skillId="0" skillLvl="0" /> <!-- Britra --> <pet id="157" name="Britra" />
<pet id="158" skillId="0" skillLvl="0" /> <!-- Python --> <pet id="158" name="Python" />
<pet id="159" skillId="0" skillLvl="0" /> <!-- Baxter --> <pet id="159" name="Baxter" />
<pet id="160" skillId="0" skillLvl="0" /> <!-- Aydan --> <pet id="160" name="Aydan" />
<pet id="161" skillId="0" skillLvl="0" /> <!-- Fire Lord --> <pet id="161" name="Fire Lord" />
<pet id="162" skillId="0" skillLvl="0" /> <!-- Ancient Dragon --> <pet id="162" name="Ancient Dragon" />
<pet id="163" skillId="0" skillLvl="0" /> <!-- Antharas' Offspring --> <pet id="163" name="Antharas' Offspring" />
<pet id="164" skillId="0" skillLvl="0" /> <!-- Lucky Coin: Attack --> <pet id="164" name="Lucky Coin: Attack" />
<pet id="165" skillId="0" skillLvl="0" /> <!-- Condor --> <pet id="165" name="Condor" />
<pet id="166" skillId="0" skillLvl="0" /> <!-- Horus --> <pet id="166" name="Horus" />
<pet id="167" skillId="0" skillLvl="0" /> <!-- Attila --> <pet id="167" name="Attila" />
<pet id="168" skillId="0" skillLvl="0" /> <!-- Lachman --> <pet id="168" name="Lachman" />
<pet id="169" skillId="0" skillLvl="0" /> <!-- Phoenix --> <pet id="169" name="Phoenix" />
<pet id="170" skillId="0" skillLvl="0" /> <!-- Arvid --> <pet id="170" name="Arvid" />
<pet id="171" skillId="0" skillLvl="0" /> <!-- Kalan --> <pet id="171" name="Kalan" />
<pet id="172" skillId="0" skillLvl="0" /> <!-- Roxxy --> <pet id="172" name="Roxxy" />
<pet id="173" skillId="0" skillLvl="0" /> <!-- Condor --> <pet id="173" name="Condor" />
<pet id="174" skillId="0" skillLvl="0" /> <!-- Falco Peregrinus --> <pet id="174" name="Falco Peregrinus" />
<pet id="175" skillId="0" skillLvl="0" /> <!-- Marsh Harrier --> <pet id="175" name="Marsh Harrier" />
<pet id="176" skillId="0" skillLvl="0" /> <!-- Seer --> <pet id="176" name="Seer" />
<pet id="177" skillId="0" skillLvl="0" /> <!-- Sky Lord --> <pet id="177" name="Sky Lord" />
<pet id="178" skillId="0" skillLvl="0" /> <!-- Ostrich --> <pet id="178" name="Ostrich" />
<pet id="179" skillId="0" skillLvl="0" /> <!-- Cloud --> <pet id="179" name="Cloud" />
<pet id="180" skillId="0" skillLvl="0" /> <!-- Andrew --> <pet id="180" name="Andrew" />
<pet id="181" skillId="0" skillLvl="0" /> <!-- Cloud --> <pet id="181" name="Cloud" />
<pet id="182" skillId="0" skillLvl="0" /> <!-- Hazel --> <pet id="182" name="Hazel" />
<pet id="183" skillId="0" skillLvl="0" /> <!-- Pepper --> <pet id="183" name="Pepper" />
<pet id="184" skillId="0" skillLvl="0" /> <!-- Savannah --> <pet id="184" name="Savannah" />
<pet id="185" skillId="0" skillLvl="0" /> <!-- Ruffian of Plains --> <pet id="185" name="Ruffian of Plains" />
<pet id="186" skillId="0" skillLvl="0" /> <!-- King of Snow Peaks --> <pet id="186" name="King of Snow Peaks" />
<pet id="187" skillId="0" skillLvl="0" /> <!-- Salamander --> <pet id="187" name="Salamander" />
<pet id="188" skillId="0" skillLvl="0" /> <!-- Hawkeye --> <pet id="188" name="Hawkeye" />
<pet id="189" skillId="0" skillLvl="0" /> <!-- Tanker --> <pet id="189" name="Tanker" />
<pet id="190" skillId="0" skillLvl="0" /> <!-- Tom --> <pet id="190" name="Tom" />
<pet id="191" skillId="0" skillLvl="0" /> <!-- Andrew --> <pet id="191" name="Andrew" />
<pet id="192" skillId="0" skillLvl="0" /> <!-- Bartz --> <pet id="192" name="Bartz" />
<pet id="193" skillId="0" skillLvl="0" /> <!-- Sieghardt --> <pet id="193" name="Sieghardt" />
<pet id="194" skillId="0" skillLvl="0" /> <!-- Kain --> <pet id="194" name="Kain" />
<pet id="195" skillId="0" skillLvl="0" /> <!-- Liona --> <pet id="195" name="Liona" />
<pet id="196" skillId="0" skillLvl="0" /> <!-- Erica --> <pet id="196" name="Erica" />
<pet id="197" skillId="0" skillLvl="0" /> <!-- Gustin --> <pet id="197" name="Gustin" />
<pet id="198" skillId="0" skillLvl="0" /> <!-- Devianne --> <pet id="198" name="Devianne" />
<pet id="199" skillId="0" skillLvl="0" /> <!-- Hindemith --> <pet id="199" name="Hindemith" />
<pet id="200" skillId="0" skillLvl="0" /> <!-- Teon --> <pet id="200" name="Teon" />
<pet id="201" skillId="0" skillLvl="0" /> <!-- Franz --> <pet id="201" name="Franz" />
<pet id="202" skillId="0" skillLvl="0" /> <!-- Lunar --> <pet id="202" name="Lunar" />
<pet id="203" skillId="0" skillLvl="0" /> <!-- Kastien --> <pet id="203" name="Kastien" />
<pet id="204" skillId="0" skillLvl="0" /> <!-- Irene --> <pet id="204" name="Irene" />
<pet id="205" skillId="0" skillLvl="0" /> <!-- Staris --> <pet id="205" name="Staris" />
<pet id="206" skillId="0" skillLvl="0" /> <!-- Ceriel --> <pet id="206" name="Ceriel" />
<pet id="207" skillId="0" skillLvl="0" /> <!-- Feyshar --> <pet id="207" name="Feyshar" />
<pet id="208" skillId="0" skillLvl="0" /> <!-- Elwyn --> <pet id="208" name="Elwyn" />
<pet id="209" skillId="0" skillLvl="0" /> <!-- Elikia --> <pet id="209" name="Elikia" />
<pet id="210" skillId="0" skillLvl="0" /> <!-- Shiken --> <pet id="210" name="Shiken" />
<pet id="211" skillId="0" skillLvl="0" /> <!-- Scryde --> <pet id="211" name="Scryde" />
<pet id="212" skillId="0" skillLvl="0" /> <!-- Frikios --> <pet id="212" name="Frikios" />
<pet id="213" skillId="0" skillLvl="0" /> <!-- Ophilia --> <pet id="213" name="Ophilia" />
<pet id="214" skillId="0" skillLvl="0" /> <!-- Sake Dun --> <pet id="214" name="Sake Dun" />
<pet id="215" skillId="0" skillLvl="0" /> <!-- Tazyph --> <pet id="215" name="Tazyph" />
<pet id="216" skillId="0" skillLvl="0" /> <!-- Arian --> <pet id="216" name="Arian" />
<pet id="217" skillId="0" skillLvl="0" /> <!-- Asyen --> <pet id="217" name="Asyen" />
<pet id="218" skillId="0" skillLvl="0" /> <!-- Elcadia --> <pet id="218" name="Elcadia" />
<pet id="219" skillId="0" skillLvl="0" /> <!-- Ian --> <pet id="219" name="Ian" />
<pet id="220" skillId="0" skillLvl="0" /> <!-- Seresin --> <pet id="220" name="Seresin" />
<pet id="221" skillId="0" skillLvl="0" /> <!-- Tarkai --> <pet id="221" name="Tarkai" />
<pet id="222" skillId="0" skillLvl="0" /> <!-- Cardia --> <pet id="222" name="Cardia" />
<pet id="223" skillId="0" skillLvl="0" /> <!-- Roien --> <pet id="223" name="Roien" />
<pet id="224" skillId="0" skillLvl="0" /> <!-- Gallint --> <pet id="224" name="Gallint" />
<pet id="225" skillId="0" skillLvl="0" /> <!-- Tiat --> <pet id="225" name="Tiat" />
<pet id="226" skillId="0" skillLvl="0" /> <!-- Nevit --> <pet id="226" name="Nevit" />
<pet id="227" skillId="0" skillLvl="0" /> <!-- Karan --> <pet id="227" name="Karan" />
<pet id="228" skillId="0" skillLvl="0" /> <!-- Tersi --> <pet id="228" name="Tersi" />
<pet id="229" skillId="0" skillLvl="0" /> <!-- Bremnon --> <pet id="229" name="Bremnon" />
<pet id="230" skillId="0" skillLvl="0" /> <!-- Lionel --> <pet id="230" name="Lionel" />
<pet id="231" skillId="0" skillLvl="0" /> <!-- Adat --> <pet id="231" name="Adat" />
<pet id="232" skillId="0" skillLvl="0" /> <!-- Elizabeth --> <pet id="232" name="Elizabeth" />
<pet id="233" skillId="0" skillLvl="0" /> <!-- Wunderkind --> <pet id="233" name="Wunderkind" />
<pet id="234" skillId="0" skillLvl="0" /> <!-- Lucky --> <pet id="234" name="Lucky" />
</list> </list>

View File

@@ -8,8 +8,9 @@
<xs:simpleContent> <xs:simpleContent>
<xs:extension base="xs:string"> <xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" /> <xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="skillId" use="required" /> <xs:attribute type="xs:string" name="name" use="required" />
<xs:attribute type="xs:integer" name="skillLvl" use="required" /> <xs:attribute type="xs:integer" name="skillId" use="optional" />
<xs:attribute type="xs:integer" name="skillLvl" use="optional" />
</xs:extension> </xs:extension>
</xs:simpleContent> </xs:simpleContent>
</xs:complexType> </xs:complexType>

View File

@@ -93,7 +93,7 @@ import org.l2jmobius.gameserver.data.xml.OptionData;
import org.l2jmobius.gameserver.data.xml.PetAcquireList; import org.l2jmobius.gameserver.data.xml.PetAcquireList;
import org.l2jmobius.gameserver.data.xml.PetDataTable; import org.l2jmobius.gameserver.data.xml.PetDataTable;
import org.l2jmobius.gameserver.data.xml.PetSkillData; import org.l2jmobius.gameserver.data.xml.PetSkillData;
import org.l2jmobius.gameserver.data.xml.PetTypesListData; import org.l2jmobius.gameserver.data.xml.PetTypeData;
import org.l2jmobius.gameserver.data.xml.PlayerTemplateData; import org.l2jmobius.gameserver.data.xml.PlayerTemplateData;
import org.l2jmobius.gameserver.data.xml.PlayerXpPercentLostData; import org.l2jmobius.gameserver.data.xml.PlayerXpPercentLostData;
import org.l2jmobius.gameserver.data.xml.PrimeShopData; import org.l2jmobius.gameserver.data.xml.PrimeShopData;
@@ -376,7 +376,7 @@ public class GameServer
CrestTable.getInstance(); CrestTable.getInstance();
TeleportListData.getInstance(); TeleportListData.getInstance();
SharedTeleportManager.getInstance(); SharedTeleportManager.getInstance();
PetTypesListData.getInstance(); PetTypeData.getInstance();
TeleporterData.getInstance(); TeleporterData.getInstance();
TimedHuntingZoneData.getInstance(); TimedHuntingZoneData.getInstance();
MatchingRoomManager.getInstance(); MatchingRoomManager.getInstance();

View File

@@ -17,6 +17,9 @@
package org.l2jmobius.gameserver.data.xml; package org.l2jmobius.gameserver.data.xml;
import java.io.File; import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -29,16 +32,17 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.enums.EvolveLevel; import org.l2jmobius.gameserver.enums.EvolveLevel;
import org.l2jmobius.gameserver.enums.MountType; import org.l2jmobius.gameserver.enums.MountType;
import org.l2jmobius.gameserver.model.PetData; import org.l2jmobius.gameserver.model.PetData;
import org.l2jmobius.gameserver.model.PetLevelData; import org.l2jmobius.gameserver.model.PetLevelData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
/** /**
* This class parse and hold all pet parameters.<br> * This class parse and hold all pet parameters.<br>
* TODO: load and use all pet parameters.
* @author Zoey76 (rework) * @author Zoey76 (rework)
*/ */
public class PetDataTable implements IXmlReader public class PetDataTable implements IXmlReader
@@ -46,6 +50,7 @@ public class PetDataTable implements IXmlReader
private static final Logger LOGGER = Logger.getLogger(PetDataTable.class.getName()); private static final Logger LOGGER = Logger.getLogger(PetDataTable.class.getName());
private final Map<Integer, PetData> _pets = new ConcurrentHashMap<>(); private final Map<Integer, PetData> _pets = new ConcurrentHashMap<>();
private final Map<Integer, String> _petNames = new ConcurrentHashMap<>();
/** /**
* Instantiates a new pet data table. * Instantiates a new pet data table.
@@ -60,6 +65,26 @@ public class PetDataTable implements IXmlReader
{ {
_pets.clear(); _pets.clear();
parseDatapackDirectory("data/stats/pets", false); parseDatapackDirectory("data/stats/pets", false);
try (Connection conn = DatabaseFactory.getConnection();
PreparedStatement ps = conn.prepareStatement("SELECT * FROM pets"))
{
ResultSet rs = ps.executeQuery();
while (rs.next())
{
String name = rs.getString("name");
if (name == null)
{
name = "No name";
}
_petNames.put(rs.getInt("item_obj_id"), name);
}
}
catch (Exception e)
{
LOGGER.warning(getClass().getSimpleName() + ": Problem loading pet names! " + e);
}
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _pets.size() + " pets."); LOGGER.info(getClass().getSimpleName() + ": Loaded " + _pets.size() + " pets.");
} }
@@ -277,6 +302,27 @@ public class PetDataTable implements IXmlReader
return _pets.values().stream().filter(petData -> (petData.getItemId() == itemId) && (petData.getEvolveLevel() == evolveLevel)).collect(Collectors.toList()); return _pets.values().stream().filter(petData -> (petData.getItemId() == itemId) && (petData.getEvolveLevel() == evolveLevel)).collect(Collectors.toList());
} }
public void setPetName(int objectId, String name)
{
_petNames.put(objectId, name);
}
public String getPetName(int objectId)
{
return _petNames.getOrDefault(objectId, "No name");
}
public String getNameByItemObjectId(int objectId)
{
final String name = getPetName(objectId);
final SkillHolder type = PetTypeData.getInstance().getSkillByName(name);
if (type == null)
{
return "";
}
return type.getSkillId() + ";" + type.getSkillLevel() + ";" + PetTypeData.getInstance().getIdByName(name);
}
/** /**
* Gets the single instance of PetDataTable. * Gets the single instance of PetDataTable.
* @return this class unique instance. * @return this class unique instance.

View File

@@ -0,0 +1,114 @@
/*
* 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.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
/**
* @author Mobius
*/
public class PetTypeData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(PetTypeData.class.getName());
private final Map<Integer, SkillHolder> _skills = new HashMap<>();
private final Map<Integer, String> _names = new HashMap<>();
protected PetTypeData()
{
load();
}
@Override
public void load()
{
_skills.clear();
parseDatapackFile("data/PetTypes.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _skills.size() + " pet types.");
}
@Override
public void parseDocument(Document doc, File f)
{
forEach(doc, "list", listNode -> forEach(listNode, "pet", petNode ->
{
final StatSet set = new StatSet(parseAttributes(petNode));
final int id = set.getInt("id");
_skills.put(id, new SkillHolder(set.getInt("skillId", 0), set.getInt("skillLvl", 0)));
_names.put(id, set.getString("name"));
}));
}
public SkillHolder getSkillByName(String name)
{
for (Entry<Integer, String> entry : _names.entrySet())
{
if (name.startsWith(entry.getValue()))
{
return _skills.get(entry.getKey());
}
}
return null;
}
public int getIdByName(String name)
{
for (Entry<Integer, String> entry : _names.entrySet())
{
if (name.endsWith(entry.getValue()))
{
return entry.getKey();
}
}
return 0;
}
public String getNamePrefix(Integer id)
{
return _names.get(id);
}
public String getRandomName()
{
return _names.entrySet().stream().filter(e -> e.getKey() > 100).findAny().get().getValue();
}
public Entry<Integer, SkillHolder> getRandomSkill()
{
return _skills.entrySet().stream().filter(e -> e.getValue().getSkillId() > 0).findAny().get();
}
public static PetTypeData getInstance()
{
return PetTypeData.SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final PetTypeData INSTANCE = new PetTypeData();
}
}

View File

@@ -1,85 +0,0 @@
/*
* 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.AbstractMap.SimpleEntry;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatSet;
/**
* Written by Berezkin Nikolay, on 11.04.2021
*/
public class PetTypesListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(PetTypesListData.class.getName());
private final Map<Integer, Entry<Integer, Integer>> _types = new HashMap<>();
protected PetTypesListData()
{
load();
}
@Override
public void load()
{
_types.clear();
parseDatapackFile("data/PetTypes.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _types.size() + " pet types.");
}
@Override
public void parseDocument(Document doc, File f)
{
forEach(doc, "list", listNode -> forEach(listNode, "pet", teleportNode ->
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int petType = set.getInt("id");
final int skillId = set.getInt("skillId");
final int skillLvl = set.getInt("skillLvl");
_types.put(petType, new SimpleEntry<>(skillId, skillLvl));
}));
}
public Map<Integer, Entry<Integer, Integer>> getTypes()
{
return _types;
}
public Entry<Integer, Integer> getType(int type)
{
return _types.get(type);
}
public static PetTypesListData getInstance()
{
return PetTypesListData.SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final PetTypesListData INSTANCE = new PetTypesListData();
}
}

View File

@@ -29,6 +29,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.threads.ThreadPool;
import org.l2jmobius.gameserver.data.sql.ClanTable; import org.l2jmobius.gameserver.data.sql.ClanTable;
import org.l2jmobius.gameserver.data.xml.PetDataTable; import org.l2jmobius.gameserver.data.xml.PetDataTable;
import org.l2jmobius.gameserver.model.PetData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Hero;
@@ -47,7 +48,7 @@ public class RankManager
private static final String SELECT_CHARACTERS = "SELECT charId,char_name,level,race,base_class, clanid FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 ORDER BY exp DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT; private static final String SELECT_CHARACTERS = "SELECT charId,char_name,level,race,base_class, clanid FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 ORDER BY exp DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT;
private static final String SELECT_CHARACTERS_PVP = "SELECT charId,char_name,level,race,base_class, clanid, deaths, kills, pvpkills FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 ORDER BY kills DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT; private static final String SELECT_CHARACTERS_PVP = "SELECT charId,char_name,level,race,base_class, clanid, deaths, kills, pvpkills FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 ORDER BY kills DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT;
private static final String SELECT_CHARACTERS_BY_RACE = "SELECT charId FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 AND race = ? ORDER BY exp DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT; private static final String SELECT_CHARACTERS_BY_RACE = "SELECT charId FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 AND race = ? ORDER BY exp DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT;
private static final String SELECT_PETS = "SELECT characters.charId, pets.exp, characters.char_name, pets.level as petLevel, characters.level as charLevel, characters.clanId, pet_evolves.index, pets.item_obj_id FROM characters, pets, pet_evolves WHERE pets.ownerId = characters.charId AND pet_evolves.itemObjId = pets.item_obj_id AND (" + CURRENT_TIME + " - cast(characters.lastAccess as signed) < " + TIME_LIMIT + ") AND characters.accesslevel = 0 AND pets.level > 39 ORDER BY pets.exp DESC, characters.onlinetime DESC LIMIT " + PLAYER_LIMIT; private static final String SELECT_PETS = "SELECT characters.charId, pets.exp, characters.char_name, pets.level as petLevel, characters.race as char_race, characters.level as char_level, characters.clanId, pet_evolves.index, pet_evolves.level as evolveLevel, pets.item_obj_id, item_id FROM characters, items, pets, pet_evolves WHERE pets.ownerId = characters.charId AND pet_evolves.itemObjId = items.object_id AND pet_evolves.itemObjId = pets.item_obj_id AND (" + CURRENT_TIME + " - cast(characters.lastAccess as signed) < " + TIME_LIMIT + ") AND characters.accesslevel = 0 AND pets.level > 39 ORDER BY pets.exp DESC, characters.onlinetime DESC LIMIT " + PLAYER_LIMIT;
private static final String SELECT_CLANS = "SELECT characters.level, characters.char_name, clan_data.clan_id, clan_data.clan_level, clan_data.clan_name, clan_data.reputation_score, clan_data.exp FROM characters, clan_data WHERE characters.charId = clan_data.leader_id AND characters.clanid = clan_data.clan_id AND dissolving_expiry_time = 0 ORDER BY exp DESC LIMIT " + PLAYER_LIMIT; private static final String SELECT_CLANS = "SELECT characters.level, characters.char_name, clan_data.clan_id, clan_data.clan_level, clan_data.clan_name, clan_data.reputation_score, clan_data.exp FROM characters, clan_data WHERE characters.charId = clan_data.leader_id AND characters.clanid = clan_data.clan_id AND dissolving_expiry_time = 0 ORDER BY exp DESC LIMIT " + PLAYER_LIMIT;
private static final String GET_CURRENT_CYCLE_DATA = "SELECT characters.char_name, characters.level, characters.base_class, characters.clanid, olympiad_nobles.charId, olympiad_nobles.olympiad_points, olympiad_nobles.competitions_won, olympiad_nobles.competitions_lost FROM characters, olympiad_nobles WHERE characters.charId = olympiad_nobles.charId ORDER BY olympiad_nobles.olympiad_points DESC LIMIT " + PLAYER_LIMIT; private static final String GET_CURRENT_CYCLE_DATA = "SELECT characters.char_name, characters.level, characters.base_class, characters.clanid, olympiad_nobles.charId, olympiad_nobles.olympiad_points, olympiad_nobles.competitions_won, olympiad_nobles.competitions_lost FROM characters, olympiad_nobles WHERE characters.charId = olympiad_nobles.charId ORDER BY olympiad_nobles.olympiad_points DESC LIMIT " + PLAYER_LIMIT;
@@ -232,18 +233,22 @@ public class RankManager
int i = 1; int i = 1;
while (rset.next()) while (rset.next())
{ {
final StatSet player = new StatSet(); final StatSet pet = new StatSet();
final int charId = rset.getInt("charId"); final int controlledItemObjId = rset.getInt("item_obj_id");
player.set("charId", charId); pet.set("controlledItemObjId", controlledItemObjId);
player.set("name", rset.getString("char_name")); pet.set("name", PetDataTable.getInstance().getNameByItemObjectId(controlledItemObjId));
player.set("level", rset.getInt("charLevel")); pet.set("ownerId", rset.getInt("charId"));
player.set("petLevel", rset.getInt("petLevel")); pet.set("owner_name", rset.getString("char_name"));
player.set("clanName", rset.getInt("clanid") > 0 ? ClanTable.getInstance().getClan(rset.getInt("clanid")).getName() : ""); pet.set("owner_race", rset.getString("char_race"));
player.set("petType", PetDataTable.getInstance().getTypeByIndex(rset.getInt("index"))); pet.set("owner_level", rset.getInt("char_level"));
player.set("exp", rset.getLong("exp")); pet.set("level", rset.getInt("petLevel"));
player.set("controlledItemObjId", rset.getInt("item_obj_id")); pet.set("evolve_level", rset.getInt("evolveLevel"));
_mainPetList.put(i, player); pet.set("exp", rset.getLong("exp"));
i++; pet.set("clanName", rset.getInt("clanid") > 0 ? ClanTable.getInstance().getClan(rset.getInt("clanid")).getName() : "");
final PetData petData = PetDataTable.getInstance().getPetDataByItemId(rset.getInt("item_id"));
pet.set("petType", petData.getType());
pet.set("npcId", petData.getNpcId());
_mainPetList.put(i++, pet);
} }
} }
} }

View File

@@ -2,25 +2,24 @@ package org.l2jmobius.gameserver.network.clientpackets.pet;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.stream.Collectors;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.data.xml.PetDataTable; import org.l2jmobius.gameserver.data.xml.PetDataTable;
import org.l2jmobius.gameserver.data.xml.PetTypesListData; import org.l2jmobius.gameserver.data.xml.PetTypeData;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.enums.EvolveLevel; import org.l2jmobius.gameserver.enums.EvolveLevel;
import org.l2jmobius.gameserver.model.PetData; import org.l2jmobius.gameserver.model.PetData;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.instance.Pet; import org.l2jmobius.gameserver.model.actor.instance.Pet;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/** /**
* Written by Berezkin Nikolay, on 25.04.2021 * @author Berezkin Nikolay, Mobius
*/ */
public class ExEvolvePet implements IClientIncomingPacket public class ExEvolvePet implements IClientIncomingPacket
{ {
@@ -79,23 +78,26 @@ public class ExEvolvePet implements IClientIncomingPacket
final NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(evolveLevel == EvolveLevel.Second ? pet.getId() + 2 : petData.getNpcId()); final NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(evolveLevel == EvolveLevel.Second ? pet.getId() + 2 : petData.getNpcId());
final Pet evolved = Pet.spawnPet(npcTemplate, activeChar, controlItem); final Pet evolved = Pet.spawnPet(npcTemplate, activeChar, controlItem);
if (evolved == null) if (evolved == null)
{ {
return; return;
} }
if (evolveLevel == EvolveLevel.First)
{
final Entry<Integer, SkillHolder> skillType = PetTypeData.getInstance().getRandomSkill();
final String name = PetTypeData.getInstance().getNamePrefix(skillType.getKey()) + " " + PetTypeData.getInstance().getRandomName();
evolved.addSkill(skillType.getValue().getSkill());
evolved.setName(name);
PetDataTable.getInstance().setPetName(controlItem.getObjectId(), name);
}
activeChar.setPet(evolved); activeChar.setPet(evolved);
evolved.setShowSummonAnimation(true); evolved.setShowSummonAnimation(true);
evolved.setEvolveLevel(evolveLevel); evolved.setEvolveLevel(evolveLevel);
evolved.setRunning(); evolved.setRunning();
evolved.storeEvolvedPets(evolveLevel.ordinal(), evolved.getPetData().getIndex(), controlItem.getObjectId()); evolved.storeEvolvedPets(evolveLevel.ordinal(), evolved.getPetData().getIndex(), controlItem.getObjectId());
controlItem.setEnchantLevel(evolved.getLevel()); controlItem.setEnchantLevel(evolved.getLevel());
if (evolveLevel == EvolveLevel.First)
{
final List<Entry<Integer, Entry<Integer, Integer>>> specialTypes = PetTypesListData.getInstance().getTypes().entrySet().stream().filter(it -> it.getValue().getKey() != 0).collect(Collectors.toList());
final int randomIndex = Rnd.get(specialTypes.size() - 1);
evolved.addSkill(SkillData.getInstance().getSkill(specialTypes.get(randomIndex).getValue().getKey(), specialTypes.get(randomIndex).getValue().getValue()));
}
evolved.spawnMe(pet.getX(), pet.getY(), pet.getZ()); evolved.spawnMe(pet.getX(), pet.getY(), pet.getZ());
evolved.startFeed(); evolved.startFeed();
} }

View File

@@ -23,14 +23,14 @@ import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExPetRankingList; import org.l2jmobius.gameserver.network.serverpackets.ranking.ExPetRankingList;
/** /**
* Written by Berezkin Nikolay, on 10.05.2021 * @author Mobius
*/ */
public class RequestPetRankingList implements IClientIncomingPacket public class RequestPetRankingList implements IClientIncomingPacket
{ {
private int _season; private int _season;
private int _tabId; private int _tabId;
private int _type; private int _type;
private int _race; private int _petItemObjectId;
@Override @Override
public boolean read(GameClient client, PacketReader packet) public boolean read(GameClient client, PacketReader packet)
@@ -38,7 +38,7 @@ public class RequestPetRankingList implements IClientIncomingPacket
_season = packet.readC(); _season = packet.readC();
_tabId = packet.readC(); _tabId = packet.readC();
_type = packet.readC(); _type = packet.readC();
_race = packet.readD(); _petItemObjectId = packet.readD();
return true; return true;
} }
@@ -51,6 +51,6 @@ public class RequestPetRankingList implements IClientIncomingPacket
return; return;
} }
player.sendPacket(new ExPetRankingList(player, _season, _tabId, _type, _race)); player.sendPacket(new ExPetRankingList(player, _season, _tabId, _type, _petItemObjectId));
} }
} }

View File

@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/** /**
* Written by Berezkin Nikolay, on 10.05.2021 * @author Mobius
*/ */
public class ExPetRankingList implements IClientOutgoingPacket public class ExPetRankingList implements IClientOutgoingPacket
{ {
@@ -41,17 +41,17 @@ public class ExPetRankingList implements IClientOutgoingPacket
private final int _season; private final int _season;
private final int _tabId; private final int _tabId;
private final int _type; private final int _type;
private final int _race; private final int _petItemObjectId;
private final Map<Integer, StatSet> _playerList; private final Map<Integer, StatSet> _playerList;
private final Map<Integer, StatSet> _snapshotList; private final Map<Integer, StatSet> _snapshotList;
public ExPetRankingList(Player player, int season, int tabId, int type, int race) public ExPetRankingList(Player player, int season, int tabId, int type, int petItemObjectId)
{ {
_player = player; _player = player;
_season = season; _season = season;
_tabId = tabId; _tabId = tabId;
_type = type; _type = type;
_race = race; _petItemObjectId = petItemObjectId;
_playerList = RankManager.getInstance().getPetRankList(); _playerList = RankManager.getInstance().getPetRankList();
_snapshotList = RankManager.getInstance().getSnapshotPetRankList(); _snapshotList = RankManager.getInstance().getSnapshotPetRankList();
} }
@@ -62,13 +62,12 @@ public class ExPetRankingList implements IClientOutgoingPacket
OutgoingPackets.EX_PET_RANKING_LIST.writeId(packet); OutgoingPackets.EX_PET_RANKING_LIST.writeId(packet);
packet.writeC(_season); packet.writeC(_season);
packet.writeC(_tabId); packet.writeC(_tabId);
packet.writeC(_type); packet.writeH(_type);
packet.writeD(_race); packet.writeD(_petItemObjectId);
packet.writeC(0); if (!_playerList.isEmpty())
if (!_playerList.isEmpty() && (_type != 255) && (_race != 255))
{ {
final RankingCategory category = RankingCategory.values()[_season]; final RankingCategory category = RankingCategory.values()[_tabId];
writeFilteredRankingData(packet, category, category.getScopeByGroup(_tabId)); writeFilteredRankingData(packet, category, category.getScopeByGroup(_season));
} }
else else
{ {
@@ -141,22 +140,22 @@ public class ExPetRankingList implements IClientOutgoingPacket
for (Entry<Integer, StatSet> data : limited.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList())) for (Entry<Integer, StatSet> data : limited.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList()))
{ {
int curRank = rank++; int curRank = rank++;
final StatSet player = data.getValue(); final StatSet pet = data.getValue();
packet.writeH(0); packet.writeString(pet.getString("name"));
packet.writeString(player.getString("name")); packet.writeString(pet.getString("owner_name"));
packet.writeString(player.getString("clanName")); packet.writeString(pet.getString("clanName"));
packet.writeD(player.getInt("exp")); packet.writeD(1000000 + pet.getInt("npcId"));
packet.writeH(player.getInt("petType")); packet.writeH(pet.getInt("petType"));
packet.writeH(player.getInt("petLevel")); packet.writeH(pet.getInt("level"));
packet.writeH(3); packet.writeH(pet.getInt("owner_race"));
packet.writeH(player.getInt("level")); packet.writeH(pet.getInt("owner_level"));
packet.writeD(scope == RankingScope.SELF ? data.getKey() : curRank); // server rank packet.writeD(scope == RankingScope.SELF ? data.getKey() : curRank); // server rank
if (!snapshot.isEmpty()) if (!snapshot.isEmpty())
{ {
for (Entry<Integer, StatSet> ssData : snapshot.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList())) for (Entry<Integer, StatSet> ssData : snapshot.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList()))
{ {
final StatSet snapshotData = ssData.getValue(); final StatSet snapshotData = ssData.getValue();
if (player.getInt("controlledItemObjId") == snapshotData.getInt("controlledItemObjId")) if (pet.getInt("controlledItemObjId") == snapshotData.getInt("controlledItemObjId"))
{ {
packet.writeD(scope == RankingScope.SELF ? ssData.getKey() : curRank); // server rank snapshot packet.writeD(scope == RankingScope.SELF ? ssData.getKey() : curRank); // server rank snapshot
} }

View File

@@ -1,7 +1,7 @@
DROP TABLE IF EXISTS `pets`; DROP TABLE IF EXISTS `pets`;
CREATE TABLE IF NOT EXISTS `pets` ( CREATE TABLE IF NOT EXISTS `pets` (
`item_obj_id` int(10) unsigned NOT NULL, `item_obj_id` int(10) unsigned NOT NULL,
`name` varchar(16), `name` varchar(36),
`level` smallint(2) unsigned NOT NULL, `level` smallint(2) unsigned NOT NULL,
`curHp` int(9) unsigned DEFAULT '0', `curHp` int(9) unsigned DEFAULT '0',
`curMp` int(9) unsigned DEFAULT '0', `curMp` int(9) unsigned DEFAULT '0',

View File

@@ -1,171 +1,171 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/PetTypes.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/PetTypes.xsd">
<pet id="1" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 1 --> <pet id="1" name="Wolf's Secret 1" />
<pet id="2" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 2 --> <pet id="2" name="Wolf's Secret 2" />
<pet id="3" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 3 --> <pet id="3" name="Wolf's Secret 3" />
<pet id="4" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 4 --> <pet id="4" name="Wolf's Secret 4" />
<pet id="5" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 5 --> <pet id="5" name="Wolf's Secret 5" />
<pet id="6" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 6 --> <pet id="6" name="Wolf's Secret 6" />
<pet id="7" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 7 --> <pet id="7" name="Wolf's Secret 7" />
<pet id="8" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 8 --> <pet id="8" name="Wolf's Secret 8" />
<pet id="9" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 9 --> <pet id="9" name="Wolf's Secret 9" />
<pet id="10" skillId="0" skillLvl="0" /> <!-- Wolf's Secret 10 --> <pet id="10" name="Wolf's Secret 10" />
<pet id="11" skillId="49201" skillLvl="1" /> <!-- Strong : STR +1 --> <pet id="11" name="Strong" skillId="49201" skillLvl="1" />
<pet id="12" skillId="49201" skillLvl="2" /> <!-- Mighty : STR +2 --> <pet id="12" name="Mighty" skillId="49201" skillLvl="2" />
<pet id="13" skillId="49201" skillLvl="3" /> <!-- Powerful : STR +3 --> <pet id="13" name="Powerful" skillId="49201" skillLvl="3" />
<pet id="14" skillId="49202" skillLvl="1" /> <!-- Swift : DEX +1 --> <pet id="14" name="Swift" skillId="49202" skillLvl="1" />
<pet id="15" skillId="49202" skillLvl="2" /> <!-- Quick : DEX +2 --> <pet id="15" name="Quick" skillId="49202" skillLvl="2" />
<pet id="16" skillId="49202" skillLvl="3" /> <!-- Dexterous : DEX +3 --> <pet id="16" name="Dexterous" skillId="49202" skillLvl="3" />
<pet id="17" skillId="49203" skillLvl="1" /> <!-- Healthy : CON +1 --> <pet id="17" name="Healthy" skillId="49203" skillLvl="1" />
<pet id="18" skillId="49203" skillLvl="2" /> <!-- Enduring : CON +2 --> <pet id="18" name="Enduring" skillId="49203" skillLvl="2" />
<pet id="19" skillId="49203" skillLvl="3" /> <!-- Tough : CON +3 --> <pet id="19" name="Tough" skillId="49203" skillLvl="3" />
<pet id="20" skillId="49204" skillLvl="1" /> <!-- Clever : INT +1 --> <pet id="20" name="Clever" skillId="49204" skillLvl="1" />
<pet id="21" skillId="49204" skillLvl="2" /> <!-- Smart : INT +2 --> <pet id="21" name="Smart" skillId="49204" skillLvl="2" />
<pet id="22" skillId="49204" skillLvl="3" /> <!-- Intelligent : INT +3 --> <pet id="22" name="Intelligent" skillId="49204" skillLvl="3" />
<pet id="23" skillId="49205" skillLvl="1" /> <!-- Sharp : WIT +1 --> <pet id="23" name="Sharp" skillId="49205" skillLvl="1" />
<pet id="24" skillId="49205" skillLvl="2" /> <!-- Wise : WIT +2 --> <pet id="24" name="Wise" skillId="49205" skillLvl="2" />
<pet id="25" skillId="49205" skillLvl="3" /> <!-- Insightful : WIT +3 --> <pet id="25" name="Insightful" skillId="49205" skillLvl="3" />
<pet id="26" skillId="49206" skillLvl="1" /> <!-- Vigorous : MEN +1 --> <pet id="26" name="Vigorous" skillId="49206" skillLvl="1" />
<pet id="27" skillId="49206" skillLvl="2" /> <!-- Resolute : MEN +2 --> <pet id="27" name="Resolute" skillId="49206" skillLvl="2" />
<pet id="28" skillId="49206" skillLvl="3" /> <!-- Strong-spirited : MEN +3 --> <pet id="28" name="Strong-spirited" skillId="49206" skillLvl="3" />
<pet id="29" skillId="0" skillLvl="0" /> <!-- Wolf : Common pet --> <pet id="29" name="Wolf" />
<pet id="30" skillId="0" skillLvl="0" /> <!-- Buffalo : Calf --> <pet id="30" name="Buffalo" />
<pet id="31" skillId="0" skillLvl="0" /> <!-- Tiger : Mature --> <pet id="31" name="Tiger" />
<pet id="32" skillId="0" skillLvl="0" /> <!-- Kookaburra : Ostrich relative --> <pet id="32" name="Kookaburra" />
<pet id="33" skillId="0" skillLvl="0" /> <!-- Dragon : No fire breath --> <pet id="33" name="Dragon" />
<pet id="34" skillId="0" skillLvl="0" /> <!-- Thunder Hawk : New species --> <pet id="34" name="Thunder Hawk" />
<pet id="101" skillId="0" skillLvl="0" /> <!-- Woof-woof --> <pet id="101" name="Woof-woof" />
<pet id="102" skillId="0" skillLvl="0" /> <!-- Silver Hide --> <pet id="102" name="Silver Hide" />
<pet id="103" skillId="0" skillLvl="0" /> <!-- Chun --> <pet id="103" name="Chun" />
<pet id="104" skillId="0" skillLvl="0" /> <!-- Watchdog --> <pet id="104" name="Watchdog" />
<pet id="105" skillId="0" skillLvl="0" /> <!-- Red Eye --> <pet id="105" name="Red Eye" />
<pet id="106" skillId="0" skillLvl="0" /> <!-- Robo --> <pet id="106" name="Robo" />
<pet id="107" skillId="0" skillLvl="0" /> <!-- Shepherd --> <pet id="107" name="Shepherd" />
<pet id="108" skillId="0" skillLvl="0" /> <!-- Hindo --> <pet id="108" name="Hindo" />
<pet id="109" skillId="0" skillLvl="0" /> <!-- Mary --> <pet id="109" name="Mary" />
<pet id="110" skillId="0" skillLvl="0" /> <!-- Cu Chulainn --> <pet id="110" name="Cu Chulainn" />
<pet id="111" skillId="0" skillLvl="0" /> <!-- Cu Chulainn --> <pet id="111" name="Cu Chulainn" />
<pet id="112" skillId="0" skillLvl="0" /> <!-- Robo --> <pet id="112" name="Robo" />
<pet id="113" skillId="0" skillLvl="0" /> <!-- Romulus --> <pet id="113" name="Romulus" />
<pet id="114" skillId="0" skillLvl="0" /> <!-- Phenyl --> <pet id="114" name="Phenyl" />
<pet id="115" skillId="0" skillLvl="0" /> <!-- Allen --> <pet id="115" name="Allen" />
<pet id="116" skillId="0" skillLvl="0" /> <!-- Alexander --> <pet id="116" name="Alexander" />
<pet id="117" skillId="0" skillLvl="0" /> <!-- Cardiff Wolf --> <pet id="117" name="Cardiff Wolf" />
<pet id="118" skillId="0" skillLvl="0" /> <!-- Werewolf --> <pet id="118" name="Werewolf" />
<pet id="119" skillId="0" skillLvl="0" /> <!-- Garum Wolf --> <pet id="119" name="Garum Wolf" />
<pet id="120" skillId="0" skillLvl="0" /> <!-- Kasha Wolf --> <pet id="120" name="Kasha Wolf" />
<pet id="121" skillId="0" skillLvl="0" /> <!-- Kerope Wolf --> <pet id="121" name="Kerope Wolf" />
<pet id="122" skillId="0" skillLvl="0" /> <!-- Chanlan --> <pet id="122" name="Chanlan" />
<pet id="123" skillId="0" skillLvl="0" /> <!-- Lupine King --> <pet id="123" name="Lupine King" />
<pet id="124" skillId="0" skillLvl="0" /> <!-- Forest Hunter --> <pet id="124" name="Forest Hunter" />
<pet id="125" skillId="0" skillLvl="0" /> <!-- Blue Wolf --> <pet id="125" name="Blue Wolf" />
<pet id="126" skillId="0" skillLvl="0" /> <!-- Limonite --> <pet id="126" name="Limonite" />
<pet id="127" skillId="0" skillLvl="0" /> <!-- Minota --> <pet id="127" name="Minota" />
<pet id="128" skillId="0" skillLvl="0" /> <!-- Minota --> <pet id="128" name="Minota" />
<pet id="129" skillId="0" skillLvl="0" /> <!-- Thick Skull --> <pet id="129" name="Thick Skull" />
<pet id="130" skillId="0" skillLvl="0" /> <!-- Cattle King --> <pet id="130" name="Cattle King" />
<pet id="131" skillId="0" skillLvl="0" /> <!-- Bison --> <pet id="131" name="Bison" />
<pet id="132" skillId="0" skillLvl="0" /> <!-- Auroch --> <pet id="132" name="Auroch" />
<pet id="133" skillId="0" skillLvl="0" /> <!-- Bison --> <pet id="133" name="Bison" />
<pet id="134" skillId="0" skillLvl="0" /> <!-- Apis --> <pet id="134" name="Apis" />
<pet id="135" skillId="0" skillLvl="0" /> <!-- Charles --> <pet id="135" name="Charles" />
<pet id="136" skillId="0" skillLvl="0" /> <!-- Denver --> <pet id="136" name="Denver" />
<pet id="137" skillId="0" skillLvl="0" /> <!-- Mathorn --> <pet id="137" name="Mathorn" />
<pet id="138" skillId="0" skillLvl="0" /> <!-- Desert Rogue --> <pet id="138" name="Desert Rogue" />
<pet id="139" skillId="0" skillLvl="0" /> <!-- Puss --> <pet id="139" name="Puss" />
<pet id="140" skillId="0" skillLvl="0" /> <!-- Tigger --> <pet id="140" name="Tigger" />
<pet id="141" skillId="0" skillLvl="0" /> <!-- Moggy --> <pet id="141" name="Moggy" />
<pet id="142" skillId="0" skillLvl="0" /> <!-- Kitty --> <pet id="142" name="Kitty" />
<pet id="143" skillId="0" skillLvl="0" /> <!-- Amos --> <pet id="143" name="Amos" />
<pet id="144" skillId="0" skillLvl="0" /> <!-- Sel Mahum --> <pet id="144" name="Sel Mahum" />
<pet id="145" skillId="0" skillLvl="0" /> <!-- Irene --> <pet id="145" name="Irene" />
<pet id="146" skillId="0" skillLvl="0" /> <!-- Marillia --> <pet id="146" name="Marillia" />
<pet id="147" skillId="0" skillLvl="0" /> <!-- Changun --> <pet id="147" name="Changun" />
<pet id="148" skillId="0" skillLvl="0" /> <!-- Dreadful Hunter --> <pet id="148" name="Dreadful Hunter" />
<pet id="149" skillId="0" skillLvl="0" /> <!-- Forest Ghost --> <pet id="149" name="Forest Ghost" />
<pet id="150" skillId="0" skillLvl="0" /> <!-- Beast King --> <pet id="150" name="Beast King" />
<pet id="151" skillId="0" skillLvl="0" /> <!-- Dark Assassin --> <pet id="151" name="Dark Assassin" />
<pet id="152" skillId="0" skillLvl="0" /> <!-- Master of the Jungle --> <pet id="152" name="Master of the Jungle" />
<pet id="153" skillId="0" skillLvl="0" /> <!-- Hatchling --> <pet id="153" name="Hatchling" />
<pet id="154" skillId="0" skillLvl="0" /> <!-- Fafnir --> <pet id="154" name="Fafnir" />
<pet id="155" skillId="0" skillLvl="0" /> <!-- Quetzalcoatl --> <pet id="155" name="Quetzalcoatl" />
<pet id="156" skillId="0" skillLvl="0" /> <!-- Fafnir --> <pet id="156" name="Fafnir" />
<pet id="157" skillId="0" skillLvl="0" /> <!-- Britra --> <pet id="157" name="Britra" />
<pet id="158" skillId="0" skillLvl="0" /> <!-- Python --> <pet id="158" name="Python" />
<pet id="159" skillId="0" skillLvl="0" /> <!-- Baxter --> <pet id="159" name="Baxter" />
<pet id="160" skillId="0" skillLvl="0" /> <!-- Aydan --> <pet id="160" name="Aydan" />
<pet id="161" skillId="0" skillLvl="0" /> <!-- Fire Lord --> <pet id="161" name="Fire Lord" />
<pet id="162" skillId="0" skillLvl="0" /> <!-- Ancient Dragon --> <pet id="162" name="Ancient Dragon" />
<pet id="163" skillId="0" skillLvl="0" /> <!-- Antharas' Offspring --> <pet id="163" name="Antharas' Offspring" />
<pet id="164" skillId="0" skillLvl="0" /> <!-- Lucky Coin: Attack --> <pet id="164" name="Lucky Coin: Attack" />
<pet id="165" skillId="0" skillLvl="0" /> <!-- Condor --> <pet id="165" name="Condor" />
<pet id="166" skillId="0" skillLvl="0" /> <!-- Horus --> <pet id="166" name="Horus" />
<pet id="167" skillId="0" skillLvl="0" /> <!-- Attila --> <pet id="167" name="Attila" />
<pet id="168" skillId="0" skillLvl="0" /> <!-- Lachman --> <pet id="168" name="Lachman" />
<pet id="169" skillId="0" skillLvl="0" /> <!-- Phoenix --> <pet id="169" name="Phoenix" />
<pet id="170" skillId="0" skillLvl="0" /> <!-- Arvid --> <pet id="170" name="Arvid" />
<pet id="171" skillId="0" skillLvl="0" /> <!-- Kalan --> <pet id="171" name="Kalan" />
<pet id="172" skillId="0" skillLvl="0" /> <!-- Roxxy --> <pet id="172" name="Roxxy" />
<pet id="173" skillId="0" skillLvl="0" /> <!-- Condor --> <pet id="173" name="Condor" />
<pet id="174" skillId="0" skillLvl="0" /> <!-- Falco Peregrinus --> <pet id="174" name="Falco Peregrinus" />
<pet id="175" skillId="0" skillLvl="0" /> <!-- Marsh Harrier --> <pet id="175" name="Marsh Harrier" />
<pet id="176" skillId="0" skillLvl="0" /> <!-- Seer --> <pet id="176" name="Seer" />
<pet id="177" skillId="0" skillLvl="0" /> <!-- Sky Lord --> <pet id="177" name="Sky Lord" />
<pet id="178" skillId="0" skillLvl="0" /> <!-- Ostrich --> <pet id="178" name="Ostrich" />
<pet id="179" skillId="0" skillLvl="0" /> <!-- Cloud --> <pet id="179" name="Cloud" />
<pet id="180" skillId="0" skillLvl="0" /> <!-- Andrew --> <pet id="180" name="Andrew" />
<pet id="181" skillId="0" skillLvl="0" /> <!-- Cloud --> <pet id="181" name="Cloud" />
<pet id="182" skillId="0" skillLvl="0" /> <!-- Hazel --> <pet id="182" name="Hazel" />
<pet id="183" skillId="0" skillLvl="0" /> <!-- Pepper --> <pet id="183" name="Pepper" />
<pet id="184" skillId="0" skillLvl="0" /> <!-- Savannah --> <pet id="184" name="Savannah" />
<pet id="185" skillId="0" skillLvl="0" /> <!-- Ruffian of Plains --> <pet id="185" name="Ruffian of Plains" />
<pet id="186" skillId="0" skillLvl="0" /> <!-- King of Snow Peaks --> <pet id="186" name="King of Snow Peaks" />
<pet id="187" skillId="0" skillLvl="0" /> <!-- Salamander --> <pet id="187" name="Salamander" />
<pet id="188" skillId="0" skillLvl="0" /> <!-- Hawkeye --> <pet id="188" name="Hawkeye" />
<pet id="189" skillId="0" skillLvl="0" /> <!-- Tanker --> <pet id="189" name="Tanker" />
<pet id="190" skillId="0" skillLvl="0" /> <!-- Tom --> <pet id="190" name="Tom" />
<pet id="191" skillId="0" skillLvl="0" /> <!-- Andrew --> <pet id="191" name="Andrew" />
<pet id="192" skillId="0" skillLvl="0" /> <!-- Bartz --> <pet id="192" name="Bartz" />
<pet id="193" skillId="0" skillLvl="0" /> <!-- Sieghardt --> <pet id="193" name="Sieghardt" />
<pet id="194" skillId="0" skillLvl="0" /> <!-- Kain --> <pet id="194" name="Kain" />
<pet id="195" skillId="0" skillLvl="0" /> <!-- Liona --> <pet id="195" name="Liona" />
<pet id="196" skillId="0" skillLvl="0" /> <!-- Erica --> <pet id="196" name="Erica" />
<pet id="197" skillId="0" skillLvl="0" /> <!-- Gustin --> <pet id="197" name="Gustin" />
<pet id="198" skillId="0" skillLvl="0" /> <!-- Devianne --> <pet id="198" name="Devianne" />
<pet id="199" skillId="0" skillLvl="0" /> <!-- Hindemith --> <pet id="199" name="Hindemith" />
<pet id="200" skillId="0" skillLvl="0" /> <!-- Teon --> <pet id="200" name="Teon" />
<pet id="201" skillId="0" skillLvl="0" /> <!-- Franz --> <pet id="201" name="Franz" />
<pet id="202" skillId="0" skillLvl="0" /> <!-- Lunar --> <pet id="202" name="Lunar" />
<pet id="203" skillId="0" skillLvl="0" /> <!-- Kastien --> <pet id="203" name="Kastien" />
<pet id="204" skillId="0" skillLvl="0" /> <!-- Irene --> <pet id="204" name="Irene" />
<pet id="205" skillId="0" skillLvl="0" /> <!-- Staris --> <pet id="205" name="Staris" />
<pet id="206" skillId="0" skillLvl="0" /> <!-- Ceriel --> <pet id="206" name="Ceriel" />
<pet id="207" skillId="0" skillLvl="0" /> <!-- Feyshar --> <pet id="207" name="Feyshar" />
<pet id="208" skillId="0" skillLvl="0" /> <!-- Elwyn --> <pet id="208" name="Elwyn" />
<pet id="209" skillId="0" skillLvl="0" /> <!-- Elikia --> <pet id="209" name="Elikia" />
<pet id="210" skillId="0" skillLvl="0" /> <!-- Shiken --> <pet id="210" name="Shiken" />
<pet id="211" skillId="0" skillLvl="0" /> <!-- Scryde --> <pet id="211" name="Scryde" />
<pet id="212" skillId="0" skillLvl="0" /> <!-- Frikios --> <pet id="212" name="Frikios" />
<pet id="213" skillId="0" skillLvl="0" /> <!-- Ophilia --> <pet id="213" name="Ophilia" />
<pet id="214" skillId="0" skillLvl="0" /> <!-- Sake Dun --> <pet id="214" name="Sake Dun" />
<pet id="215" skillId="0" skillLvl="0" /> <!-- Tazyph --> <pet id="215" name="Tazyph" />
<pet id="216" skillId="0" skillLvl="0" /> <!-- Arian --> <pet id="216" name="Arian" />
<pet id="217" skillId="0" skillLvl="0" /> <!-- Asyen --> <pet id="217" name="Asyen" />
<pet id="218" skillId="0" skillLvl="0" /> <!-- Elcadia --> <pet id="218" name="Elcadia" />
<pet id="219" skillId="0" skillLvl="0" /> <!-- Ian --> <pet id="219" name="Ian" />
<pet id="220" skillId="0" skillLvl="0" /> <!-- Seresin --> <pet id="220" name="Seresin" />
<pet id="221" skillId="0" skillLvl="0" /> <!-- Tarkai --> <pet id="221" name="Tarkai" />
<pet id="222" skillId="0" skillLvl="0" /> <!-- Cardia --> <pet id="222" name="Cardia" />
<pet id="223" skillId="0" skillLvl="0" /> <!-- Roien --> <pet id="223" name="Roien" />
<pet id="224" skillId="0" skillLvl="0" /> <!-- Gallint --> <pet id="224" name="Gallint" />
<pet id="225" skillId="0" skillLvl="0" /> <!-- Tiat --> <pet id="225" name="Tiat" />
<pet id="226" skillId="0" skillLvl="0" /> <!-- Nevit --> <pet id="226" name="Nevit" />
<pet id="227" skillId="0" skillLvl="0" /> <!-- Karan --> <pet id="227" name="Karan" />
<pet id="228" skillId="0" skillLvl="0" /> <!-- Tersi --> <pet id="228" name="Tersi" />
<pet id="229" skillId="0" skillLvl="0" /> <!-- Bremnon --> <pet id="229" name="Bremnon" />
<pet id="230" skillId="0" skillLvl="0" /> <!-- Lionel --> <pet id="230" name="Lionel" />
<pet id="231" skillId="0" skillLvl="0" /> <!-- Adat --> <pet id="231" name="Adat" />
<pet id="232" skillId="0" skillLvl="0" /> <!-- Elizabeth --> <pet id="232" name="Elizabeth" />
<pet id="233" skillId="0" skillLvl="0" /> <!-- Wunderkind --> <pet id="233" name="Wunderkind" />
<pet id="234" skillId="0" skillLvl="0" /> <!-- Lucky --> <pet id="234" name="Lucky" />
</list> </list>

View File

@@ -8,8 +8,9 @@
<xs:simpleContent> <xs:simpleContent>
<xs:extension base="xs:string"> <xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" /> <xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="skillId" use="required" /> <xs:attribute type="xs:string" name="name" use="required" />
<xs:attribute type="xs:integer" name="skillLvl" use="required" /> <xs:attribute type="xs:integer" name="skillId" use="optional" />
<xs:attribute type="xs:integer" name="skillLvl" use="optional" />
</xs:extension> </xs:extension>
</xs:simpleContent> </xs:simpleContent>
</xs:complexType> </xs:complexType>

View File

@@ -96,7 +96,7 @@ import org.l2jmobius.gameserver.data.xml.OptionData;
import org.l2jmobius.gameserver.data.xml.PetAcquireList; import org.l2jmobius.gameserver.data.xml.PetAcquireList;
import org.l2jmobius.gameserver.data.xml.PetDataTable; import org.l2jmobius.gameserver.data.xml.PetDataTable;
import org.l2jmobius.gameserver.data.xml.PetSkillData; import org.l2jmobius.gameserver.data.xml.PetSkillData;
import org.l2jmobius.gameserver.data.xml.PetTypesListData; import org.l2jmobius.gameserver.data.xml.PetTypeData;
import org.l2jmobius.gameserver.data.xml.PlayerTemplateData; import org.l2jmobius.gameserver.data.xml.PlayerTemplateData;
import org.l2jmobius.gameserver.data.xml.PlayerXpPercentLostData; import org.l2jmobius.gameserver.data.xml.PlayerXpPercentLostData;
import org.l2jmobius.gameserver.data.xml.PrimeShopData; import org.l2jmobius.gameserver.data.xml.PrimeShopData;
@@ -384,7 +384,7 @@ public class GameServer
CrestTable.getInstance(); CrestTable.getInstance();
TeleportListData.getInstance(); TeleportListData.getInstance();
SharedTeleportManager.getInstance(); SharedTeleportManager.getInstance();
PetTypesListData.getInstance(); PetTypeData.getInstance();
TeleporterData.getInstance(); TeleporterData.getInstance();
TimedHuntingZoneData.getInstance(); TimedHuntingZoneData.getInstance();
MatchingRoomManager.getInstance(); MatchingRoomManager.getInstance();

View File

@@ -17,6 +17,9 @@
package org.l2jmobius.gameserver.data.xml; package org.l2jmobius.gameserver.data.xml;
import java.io.File; import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -29,16 +32,17 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.enums.EvolveLevel; import org.l2jmobius.gameserver.enums.EvolveLevel;
import org.l2jmobius.gameserver.enums.MountType; import org.l2jmobius.gameserver.enums.MountType;
import org.l2jmobius.gameserver.model.PetData; import org.l2jmobius.gameserver.model.PetData;
import org.l2jmobius.gameserver.model.PetLevelData; import org.l2jmobius.gameserver.model.PetLevelData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
/** /**
* This class parse and hold all pet parameters.<br> * This class parse and hold all pet parameters.<br>
* TODO: load and use all pet parameters.
* @author Zoey76 (rework) * @author Zoey76 (rework)
*/ */
public class PetDataTable implements IXmlReader public class PetDataTable implements IXmlReader
@@ -46,6 +50,7 @@ public class PetDataTable implements IXmlReader
private static final Logger LOGGER = Logger.getLogger(PetDataTable.class.getName()); private static final Logger LOGGER = Logger.getLogger(PetDataTable.class.getName());
private final Map<Integer, PetData> _pets = new ConcurrentHashMap<>(); private final Map<Integer, PetData> _pets = new ConcurrentHashMap<>();
private final Map<Integer, String> _petNames = new ConcurrentHashMap<>();
/** /**
* Instantiates a new pet data table. * Instantiates a new pet data table.
@@ -60,6 +65,26 @@ public class PetDataTable implements IXmlReader
{ {
_pets.clear(); _pets.clear();
parseDatapackDirectory("data/stats/pets", false); parseDatapackDirectory("data/stats/pets", false);
try (Connection conn = DatabaseFactory.getConnection();
PreparedStatement ps = conn.prepareStatement("SELECT * FROM pets"))
{
ResultSet rs = ps.executeQuery();
while (rs.next())
{
String name = rs.getString("name");
if (name == null)
{
name = "No name";
}
_petNames.put(rs.getInt("item_obj_id"), name);
}
}
catch (Exception e)
{
LOGGER.warning(getClass().getSimpleName() + ": Problem loading pet names! " + e);
}
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _pets.size() + " pets."); LOGGER.info(getClass().getSimpleName() + ": Loaded " + _pets.size() + " pets.");
} }
@@ -277,6 +302,27 @@ public class PetDataTable implements IXmlReader
return _pets.values().stream().filter(petData -> (petData.getItemId() == itemId) && (petData.getEvolveLevel() == evolveLevel)).collect(Collectors.toList()); return _pets.values().stream().filter(petData -> (petData.getItemId() == itemId) && (petData.getEvolveLevel() == evolveLevel)).collect(Collectors.toList());
} }
public void setPetName(int objectId, String name)
{
_petNames.put(objectId, name);
}
public String getPetName(int objectId)
{
return _petNames.getOrDefault(objectId, "No name");
}
public String getNameByItemObjectId(int objectId)
{
final String name = getPetName(objectId);
final SkillHolder type = PetTypeData.getInstance().getSkillByName(name);
if (type == null)
{
return "";
}
return type.getSkillId() + ";" + type.getSkillLevel() + ";" + PetTypeData.getInstance().getIdByName(name);
}
/** /**
* Gets the single instance of PetDataTable. * Gets the single instance of PetDataTable.
* @return this class unique instance. * @return this class unique instance.

View File

@@ -0,0 +1,114 @@
/*
* 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.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
/**
* @author Mobius
*/
public class PetTypeData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(PetTypeData.class.getName());
private final Map<Integer, SkillHolder> _skills = new HashMap<>();
private final Map<Integer, String> _names = new HashMap<>();
protected PetTypeData()
{
load();
}
@Override
public void load()
{
_skills.clear();
parseDatapackFile("data/PetTypes.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _skills.size() + " pet types.");
}
@Override
public void parseDocument(Document doc, File f)
{
forEach(doc, "list", listNode -> forEach(listNode, "pet", petNode ->
{
final StatSet set = new StatSet(parseAttributes(petNode));
final int id = set.getInt("id");
_skills.put(id, new SkillHolder(set.getInt("skillId", 0), set.getInt("skillLvl", 0)));
_names.put(id, set.getString("name"));
}));
}
public SkillHolder getSkillByName(String name)
{
for (Entry<Integer, String> entry : _names.entrySet())
{
if (name.startsWith(entry.getValue()))
{
return _skills.get(entry.getKey());
}
}
return null;
}
public int getIdByName(String name)
{
for (Entry<Integer, String> entry : _names.entrySet())
{
if (name.endsWith(entry.getValue()))
{
return entry.getKey();
}
}
return 0;
}
public String getNamePrefix(Integer id)
{
return _names.get(id);
}
public String getRandomName()
{
return _names.entrySet().stream().filter(e -> e.getKey() > 100).findAny().get().getValue();
}
public Entry<Integer, SkillHolder> getRandomSkill()
{
return _skills.entrySet().stream().filter(e -> e.getValue().getSkillId() > 0).findAny().get();
}
public static PetTypeData getInstance()
{
return PetTypeData.SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final PetTypeData INSTANCE = new PetTypeData();
}
}

View File

@@ -1,85 +0,0 @@
/*
* 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.AbstractMap.SimpleEntry;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatSet;
/**
* Written by Berezkin Nikolay, on 11.04.2021
*/
public class PetTypesListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(PetTypesListData.class.getName());
private final Map<Integer, Entry<Integer, Integer>> _types = new HashMap<>();
protected PetTypesListData()
{
load();
}
@Override
public void load()
{
_types.clear();
parseDatapackFile("data/PetTypes.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _types.size() + " pet types.");
}
@Override
public void parseDocument(Document doc, File f)
{
forEach(doc, "list", listNode -> forEach(listNode, "pet", teleportNode ->
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int petType = set.getInt("id");
final int skillId = set.getInt("skillId");
final int skillLvl = set.getInt("skillLvl");
_types.put(petType, new SimpleEntry<>(skillId, skillLvl));
}));
}
public Map<Integer, Entry<Integer, Integer>> getTypes()
{
return _types;
}
public Entry<Integer, Integer> getType(int type)
{
return _types.get(type);
}
public static PetTypesListData getInstance()
{
return PetTypesListData.SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final PetTypesListData INSTANCE = new PetTypesListData();
}
}

View File

@@ -29,6 +29,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.threads.ThreadPool;
import org.l2jmobius.gameserver.data.sql.ClanTable; import org.l2jmobius.gameserver.data.sql.ClanTable;
import org.l2jmobius.gameserver.data.xml.PetDataTable; import org.l2jmobius.gameserver.data.xml.PetDataTable;
import org.l2jmobius.gameserver.model.PetData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Hero;
@@ -47,7 +48,7 @@ public class RankManager
private static final String SELECT_CHARACTERS = "SELECT charId,char_name,level,race,base_class, clanid FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 ORDER BY exp DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT; private static final String SELECT_CHARACTERS = "SELECT charId,char_name,level,race,base_class, clanid FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 ORDER BY exp DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT;
private static final String SELECT_CHARACTERS_PVP = "SELECT charId,char_name,level,race,base_class, clanid, deaths, kills, pvpkills FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 ORDER BY kills DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT; private static final String SELECT_CHARACTERS_PVP = "SELECT charId,char_name,level,race,base_class, clanid, deaths, kills, pvpkills FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 ORDER BY kills DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT;
private static final String SELECT_CHARACTERS_BY_RACE = "SELECT charId FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 AND race = ? ORDER BY exp DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT; private static final String SELECT_CHARACTERS_BY_RACE = "SELECT charId FROM characters WHERE (" + CURRENT_TIME + " - cast(lastAccess as signed) < " + TIME_LIMIT + ") AND accesslevel = 0 AND level > 39 AND race = ? ORDER BY exp DESC, onlinetime DESC LIMIT " + PLAYER_LIMIT;
private static final String SELECT_PETS = "SELECT characters.charId, pets.exp, characters.char_name, pets.level as petLevel, characters.level as charLevel, characters.clanId, pet_evolves.index, pets.item_obj_id FROM characters, pets, pet_evolves WHERE pets.ownerId = characters.charId AND pet_evolves.itemObjId = pets.item_obj_id AND (" + CURRENT_TIME + " - cast(characters.lastAccess as signed) < " + TIME_LIMIT + ") AND characters.accesslevel = 0 AND pets.level > 39 ORDER BY pets.exp DESC, characters.onlinetime DESC LIMIT " + PLAYER_LIMIT; private static final String SELECT_PETS = "SELECT characters.charId, pets.exp, characters.char_name, pets.level as petLevel, characters.race as char_race, characters.level as char_level, characters.clanId, pet_evolves.index, pet_evolves.level as evolveLevel, pets.item_obj_id, item_id FROM characters, items, pets, pet_evolves WHERE pets.ownerId = characters.charId AND pet_evolves.itemObjId = items.object_id AND pet_evolves.itemObjId = pets.item_obj_id AND (" + CURRENT_TIME + " - cast(characters.lastAccess as signed) < " + TIME_LIMIT + ") AND characters.accesslevel = 0 AND pets.level > 39 ORDER BY pets.exp DESC, characters.onlinetime DESC LIMIT " + PLAYER_LIMIT;
private static final String SELECT_CLANS = "SELECT characters.level, characters.char_name, clan_data.clan_id, clan_data.clan_level, clan_data.clan_name, clan_data.reputation_score, clan_data.exp FROM characters, clan_data WHERE characters.charId = clan_data.leader_id AND characters.clanid = clan_data.clan_id AND dissolving_expiry_time = 0 ORDER BY exp DESC LIMIT " + PLAYER_LIMIT; private static final String SELECT_CLANS = "SELECT characters.level, characters.char_name, clan_data.clan_id, clan_data.clan_level, clan_data.clan_name, clan_data.reputation_score, clan_data.exp FROM characters, clan_data WHERE characters.charId = clan_data.leader_id AND characters.clanid = clan_data.clan_id AND dissolving_expiry_time = 0 ORDER BY exp DESC LIMIT " + PLAYER_LIMIT;
private static final String GET_CURRENT_CYCLE_DATA = "SELECT characters.char_name, characters.level, characters.base_class, characters.clanid, olympiad_nobles.charId, olympiad_nobles.olympiad_points, olympiad_nobles.competitions_won, olympiad_nobles.competitions_lost FROM characters, olympiad_nobles WHERE characters.charId = olympiad_nobles.charId ORDER BY olympiad_nobles.olympiad_points DESC LIMIT " + PLAYER_LIMIT; private static final String GET_CURRENT_CYCLE_DATA = "SELECT characters.char_name, characters.level, characters.base_class, characters.clanid, olympiad_nobles.charId, olympiad_nobles.olympiad_points, olympiad_nobles.competitions_won, olympiad_nobles.competitions_lost FROM characters, olympiad_nobles WHERE characters.charId = olympiad_nobles.charId ORDER BY olympiad_nobles.olympiad_points DESC LIMIT " + PLAYER_LIMIT;
@@ -232,18 +233,22 @@ public class RankManager
int i = 1; int i = 1;
while (rset.next()) while (rset.next())
{ {
final StatSet player = new StatSet(); final StatSet pet = new StatSet();
final int charId = rset.getInt("charId"); final int controlledItemObjId = rset.getInt("item_obj_id");
player.set("charId", charId); pet.set("controlledItemObjId", controlledItemObjId);
player.set("name", rset.getString("char_name")); pet.set("name", PetDataTable.getInstance().getNameByItemObjectId(controlledItemObjId));
player.set("level", rset.getInt("charLevel")); pet.set("ownerId", rset.getInt("charId"));
player.set("petLevel", rset.getInt("petLevel")); pet.set("owner_name", rset.getString("char_name"));
player.set("clanName", rset.getInt("clanid") > 0 ? ClanTable.getInstance().getClan(rset.getInt("clanid")).getName() : ""); pet.set("owner_race", rset.getString("char_race"));
player.set("petType", PetDataTable.getInstance().getTypeByIndex(rset.getInt("index"))); pet.set("owner_level", rset.getInt("char_level"));
player.set("exp", rset.getLong("exp")); pet.set("level", rset.getInt("petLevel"));
player.set("controlledItemObjId", rset.getInt("item_obj_id")); pet.set("evolve_level", rset.getInt("evolveLevel"));
_mainPetList.put(i, player); pet.set("exp", rset.getLong("exp"));
i++; pet.set("clanName", rset.getInt("clanid") > 0 ? ClanTable.getInstance().getClan(rset.getInt("clanid")).getName() : "");
final PetData petData = PetDataTable.getInstance().getPetDataByItemId(rset.getInt("item_id"));
pet.set("petType", petData.getType());
pet.set("npcId", petData.getNpcId());
_mainPetList.put(i++, pet);
} }
} }
} }

View File

@@ -2,25 +2,24 @@ package org.l2jmobius.gameserver.network.clientpackets.pet;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.stream.Collectors;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.data.xml.PetDataTable; import org.l2jmobius.gameserver.data.xml.PetDataTable;
import org.l2jmobius.gameserver.data.xml.PetTypesListData; import org.l2jmobius.gameserver.data.xml.PetTypeData;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.enums.EvolveLevel; import org.l2jmobius.gameserver.enums.EvolveLevel;
import org.l2jmobius.gameserver.model.PetData; import org.l2jmobius.gameserver.model.PetData;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.instance.Pet; import org.l2jmobius.gameserver.model.actor.instance.Pet;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/** /**
* Written by Berezkin Nikolay, on 25.04.2021 * @author Berezkin Nikolay, Mobius
*/ */
public class ExEvolvePet implements IClientIncomingPacket public class ExEvolvePet implements IClientIncomingPacket
{ {
@@ -79,23 +78,26 @@ public class ExEvolvePet implements IClientIncomingPacket
final NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(evolveLevel == EvolveLevel.Second ? pet.getId() + 2 : petData.getNpcId()); final NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(evolveLevel == EvolveLevel.Second ? pet.getId() + 2 : petData.getNpcId());
final Pet evolved = Pet.spawnPet(npcTemplate, activeChar, controlItem); final Pet evolved = Pet.spawnPet(npcTemplate, activeChar, controlItem);
if (evolved == null) if (evolved == null)
{ {
return; return;
} }
if (evolveLevel == EvolveLevel.First)
{
final Entry<Integer, SkillHolder> skillType = PetTypeData.getInstance().getRandomSkill();
final String name = PetTypeData.getInstance().getNamePrefix(skillType.getKey()) + " " + PetTypeData.getInstance().getRandomName();
evolved.addSkill(skillType.getValue().getSkill());
evolved.setName(name);
PetDataTable.getInstance().setPetName(controlItem.getObjectId(), name);
}
activeChar.setPet(evolved); activeChar.setPet(evolved);
evolved.setShowSummonAnimation(true); evolved.setShowSummonAnimation(true);
evolved.setEvolveLevel(evolveLevel); evolved.setEvolveLevel(evolveLevel);
evolved.setRunning(); evolved.setRunning();
evolved.storeEvolvedPets(evolveLevel.ordinal(), evolved.getPetData().getIndex(), controlItem.getObjectId()); evolved.storeEvolvedPets(evolveLevel.ordinal(), evolved.getPetData().getIndex(), controlItem.getObjectId());
controlItem.setEnchantLevel(evolved.getLevel()); controlItem.setEnchantLevel(evolved.getLevel());
if (evolveLevel == EvolveLevel.First)
{
final List<Entry<Integer, Entry<Integer, Integer>>> specialTypes = PetTypesListData.getInstance().getTypes().entrySet().stream().filter(it -> it.getValue().getKey() != 0).collect(Collectors.toList());
final int randomIndex = Rnd.get(specialTypes.size() - 1);
evolved.addSkill(SkillData.getInstance().getSkill(specialTypes.get(randomIndex).getValue().getKey(), specialTypes.get(randomIndex).getValue().getValue()));
}
evolved.spawnMe(pet.getX(), pet.getY(), pet.getZ()); evolved.spawnMe(pet.getX(), pet.getY(), pet.getZ());
evolved.startFeed(); evolved.startFeed();
} }

View File

@@ -23,14 +23,14 @@ import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExPetRankingList; import org.l2jmobius.gameserver.network.serverpackets.ranking.ExPetRankingList;
/** /**
* Written by Berezkin Nikolay, on 10.05.2021 * @author Mobius
*/ */
public class RequestPetRankingList implements IClientIncomingPacket public class RequestPetRankingList implements IClientIncomingPacket
{ {
private int _season; private int _season;
private int _tabId; private int _tabId;
private int _type; private int _type;
private int _race; private int _petItemObjectId;
@Override @Override
public boolean read(GameClient client, PacketReader packet) public boolean read(GameClient client, PacketReader packet)
@@ -38,7 +38,7 @@ public class RequestPetRankingList implements IClientIncomingPacket
_season = packet.readC(); _season = packet.readC();
_tabId = packet.readC(); _tabId = packet.readC();
_type = packet.readC(); _type = packet.readC();
_race = packet.readD(); _petItemObjectId = packet.readD();
return true; return true;
} }
@@ -51,6 +51,6 @@ public class RequestPetRankingList implements IClientIncomingPacket
return; return;
} }
player.sendPacket(new ExPetRankingList(player, _season, _tabId, _type, _race)); player.sendPacket(new ExPetRankingList(player, _season, _tabId, _type, _petItemObjectId));
} }
} }

View File

@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/** /**
* Written by Berezkin Nikolay, on 10.05.2021 * @author Mobius
*/ */
public class ExPetRankingList implements IClientOutgoingPacket public class ExPetRankingList implements IClientOutgoingPacket
{ {
@@ -41,17 +41,17 @@ public class ExPetRankingList implements IClientOutgoingPacket
private final int _season; private final int _season;
private final int _tabId; private final int _tabId;
private final int _type; private final int _type;
private final int _race; private final int _petItemObjectId;
private final Map<Integer, StatSet> _playerList; private final Map<Integer, StatSet> _playerList;
private final Map<Integer, StatSet> _snapshotList; private final Map<Integer, StatSet> _snapshotList;
public ExPetRankingList(Player player, int season, int tabId, int type, int race) public ExPetRankingList(Player player, int season, int tabId, int type, int petItemObjectId)
{ {
_player = player; _player = player;
_season = season; _season = season;
_tabId = tabId; _tabId = tabId;
_type = type; _type = type;
_race = race; _petItemObjectId = petItemObjectId;
_playerList = RankManager.getInstance().getPetRankList(); _playerList = RankManager.getInstance().getPetRankList();
_snapshotList = RankManager.getInstance().getSnapshotPetRankList(); _snapshotList = RankManager.getInstance().getSnapshotPetRankList();
} }
@@ -62,13 +62,12 @@ public class ExPetRankingList implements IClientOutgoingPacket
OutgoingPackets.EX_PET_RANKING_LIST.writeId(packet); OutgoingPackets.EX_PET_RANKING_LIST.writeId(packet);
packet.writeC(_season); packet.writeC(_season);
packet.writeC(_tabId); packet.writeC(_tabId);
packet.writeC(_type); packet.writeH(_type);
packet.writeD(_race); packet.writeD(_petItemObjectId);
packet.writeC(0); if (!_playerList.isEmpty())
if (!_playerList.isEmpty() && (_type != 255) && (_race != 255))
{ {
final RankingCategory category = RankingCategory.values()[_season]; final RankingCategory category = RankingCategory.values()[_tabId];
writeFilteredRankingData(packet, category, category.getScopeByGroup(_tabId)); writeFilteredRankingData(packet, category, category.getScopeByGroup(_season));
} }
else else
{ {
@@ -141,22 +140,22 @@ public class ExPetRankingList implements IClientOutgoingPacket
for (Entry<Integer, StatSet> data : limited.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList())) for (Entry<Integer, StatSet> data : limited.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList()))
{ {
int curRank = rank++; int curRank = rank++;
final StatSet player = data.getValue(); final StatSet pet = data.getValue();
packet.writeH(0); packet.writeString(pet.getString("name"));
packet.writeString(player.getString("name")); packet.writeString(pet.getString("owner_name"));
packet.writeString(player.getString("clanName")); packet.writeString(pet.getString("clanName"));
packet.writeD(player.getInt("exp")); packet.writeD(1000000 + pet.getInt("npcId"));
packet.writeH(player.getInt("petType")); packet.writeH(pet.getInt("petType"));
packet.writeH(player.getInt("petLevel")); packet.writeH(pet.getInt("level"));
packet.writeH(3); packet.writeH(pet.getInt("owner_race"));
packet.writeH(player.getInt("level")); packet.writeH(pet.getInt("owner_level"));
packet.writeD(scope == RankingScope.SELF ? data.getKey() : curRank); // server rank packet.writeD(scope == RankingScope.SELF ? data.getKey() : curRank); // server rank
if (!snapshot.isEmpty()) if (!snapshot.isEmpty())
{ {
for (Entry<Integer, StatSet> ssData : snapshot.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList())) for (Entry<Integer, StatSet> ssData : snapshot.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList()))
{ {
final StatSet snapshotData = ssData.getValue(); final StatSet snapshotData = ssData.getValue();
if (player.getInt("controlledItemObjId") == snapshotData.getInt("controlledItemObjId")) if (pet.getInt("controlledItemObjId") == snapshotData.getInt("controlledItemObjId"))
{ {
packet.writeD(scope == RankingScope.SELF ? ssData.getKey() : curRank); // server rank snapshot packet.writeD(scope == RankingScope.SELF ? ssData.getKey() : curRank); // server rank snapshot
} }