Hello MXC, i have code for faction server which change map every 45 mins.
But i need to make this code to pvp server, but problem is occupation crystals and teleporter set to faction ids Faction ID 1 = Blue faction Faction ID 2 = Red faction.
I need to make what you can teleport to crystal but you can't occupate crystal and can't see it and all players teleport to all crystals, who can help me, i send java code and I and good dev who help to me, have this super code:D
+ public static FastSet<L2TpFlagInstance> _tpBlueFlags = new FastSet<L2TpFlagInstance>();
+ public static FastSet<L2TpFlagInstance> _tpRedFlags = new FastSet<L2TpFlagInstance>();
CREATE TABLE `faction_crystals` (
`mapId` int(3) DEFAULT '0',
`flagName` varchar(20) NOT NULL DEFAULT 'Test',
`factionId` int(1) DEFAULT '0',
`unoccupayable` int(1) DEFAULT '0',
`x` int(7) NOT NULL DEFAULT '0',
`y` int(7) DEFAULT '0',
`z` int(7) DEFAULT '0',
PRIMARY KEY (`x`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for faction_maps
-- ----------------------------
CREATE TABLE `faction_maps` (
`mapId` int(3) DEFAULT '0',
`map_name` varchar(50) NOT NULL DEFAULT '',
`current` int(1) DEFAULT '0',
PRIMARY KEY (`map_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `characters` ADD `factionId` INT(1) DEFAULT '0' NOT NULL;
UPDATE `npc` SET type = 'L2Faction' WHERE id = '31214'
UPDATE `npc` SET type = 'L2TpFlag' WHERE id = '31217'
UPDATE `npc` SET type = 'L2FactTeleporter' WHERE id = '31218'
-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `faction_crystals` VALUES ('2', 'Red Crystal', '1', '1', '-54438', '146565', '-2878');
INSERT INTO `faction_crystals` VALUES ('2', 'Crystal 2', '0', '1', '-54257', '142692', '-2877');
INSERT INTO `faction_crystals` VALUES ('2', 'Blue Crystal', '1', '1', '-51479', '138993', '-2937');
INSERT INTO `faction_crystals` VALUES ('2', 'Crystal 1', '0', '1', '-50155', '142310', '-2893');
INSERT INTO `faction_crystals` VALUES ('1', 'Hot Springs 2', '0', '0', '140656', '-105488', '-3632');
INSERT INTO `faction_crystals` VALUES ('1', 'Hot Springs 1', '0', '0', '141632', '-109424', '-3591');
INSERT INTO `faction_crystals` VALUES ('1', 'Blue Crystal', '1', '1', '143972', '-111932', '-3447');
INSERT INTO `faction_crystals` VALUES ('1', 'Red Crystal', '2', '1', '144755', '-100687', '-3277');
INSERT INTO `faction_crystals` VALUES ('1', 'Hot Springs 3', '0', '0', '145232', '-104736', '-3681');
INSERT INTO `faction_crystals` VALUES ('0', 'Cemetery steps', '1', '1', '185352', '20300', '-3270');
INSERT INTO `faction_crystals` VALUES ('0', 'Cemetery Crystal 2', '0', '0', '188409', '22493', '-3688');
INSERT INTO `faction_crystals` VALUES ('0', 'Cemetery Crystal 1', '0', '0', '189616', '17336', '-3762');
INSERT INTO `faction_crystals` VALUES ('0', 'Cemetery Crystal 3', '0', '0', '190408', '21396', '-3670');
INSERT INTO `faction_crystals` VALUES ('0', 'Cemetery doors', '2', '1', '194072', '22928', '-3614');
INSERT INTO `faction_maps` VALUES ('2', 'Abandoned Camp', '0');
INSERT INTO `faction_maps` VALUES ('0', 'Cemetery', '1');
INSERT INTO `faction_maps` VALUES ('1', 'Hot Springs', '0');
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
1. Optimize Packet Serialization
Look in ItemList.java or wherever the inventory packet is constructed.
Instead of building the packet with inefficient string concatenation or repeated allocations, use a preallocated buffer and avoid creating new objects for each item.
Mobius sources are Java-based, so profiling with something like VisualVM or YourKit can help see where most time is spent.
2. Avoid Sending the Full List Each Time
Modify the server to send only changed items (diff packets) when the inventory window opens.
Some newer forks implement this as “lazy loading” or paged inventory so the client only loads e.g. 100 items at a time.
3. Limit the Inventory Size Per Page
Instead of showing all 500 slots at once, split the inventory into pages/tabs (100 slots each).
When the user switches a tab, send only that page’s items.
This requires some client-side editing, but it’s the most user-friendly long-term fix.
4. Database & Cache Optimizations
Ensure your items table is indexed by owner_id to make the query for player items fast.
Cache item templates and static data so they are not reloaded every time the inventory is shown.
⚠️ Things to Keep in Mind
Increasing slots from 80 → 500 does not just change a number — it multiplies the workload for packet building and UI rendering.
You can’t fully avoid some extra cost with 500 items, but you can keep it under a few milliseconds if you optimize how and when the data is sent.
i think it's the auto sorting of the interface that sucks, check InventoryWnd script in interface.u, or completely disable the request item list packet when toggling the inventory window (also in InventoryWnd script or similar name)
Question
NumL0ck
Hello MXC, i have code for faction server which change map every 45 mins.
But i need to make this code to pvp server, but problem is occupation crystals and teleporter set to faction ids Faction ID 1 = Blue faction Faction ID 2 = Red faction.
I need to make what you can teleport to crystal but you can't occupate crystal and can't see it and all players teleport to all crystals, who can help me, i send java code and I and good dev who help to me, have this super code:D
Sorry for bad english!
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.