Top.Mail.Ru

admin Дата публикации 2023-11-7 00:04:38

Буфер AIO (команды администратора + навыки)



Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java        (revision 4443)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java        (working copy)
@@ -289,7 +289,7 @@
        // Character Character SQL String Definitions:
        private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,title_color,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,createTime) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
        private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=? WHERE charId=?";
-        private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, title_color, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,vitality_points,createTime,language FROM characters WHERE charId=?";
+        private static final String RESTORE_CHARACTER = "SELECT account_name, aio, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, title_color, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,vitality_points,createTime,language FROM characters WHERE charId=?";

        // Character Teleport Bookmark:
        private static final String INSERT_TP_BOOKMARK = "INSERT INTO character_tpbookmark (charId,Id,x,y,z,icon,tag,name) values (?,?,?,?,?,?,?,?)";
@@ -7163,6 +7163,7 @@
                                player.setOnlineTime(rset.getLong("onlinetime"));
                                player.setNewbie(rset.getInt("newbie"));
                                player.setNoble(rset.getInt("nobless")==1);
+                                player.setAIO(rset.getInt("aio") == 1);

                                player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
                                if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
@@ -15095,4 +15096,16 @@
                // Maintain = 1
                return 0;
        }
+       
+        private boolean _AOIBuffer = false;
+       
+        public void setAIO(boolean aio)
+        {
+                _AOIBuffer = aio;
+        }
+       
+        public boolean isAIO()
+        {
+                return _AOIBuffer;
+        }
}

Index: data/scripts/handlers/MasterHandler.java
===================================================================
--- data/scripts/handlers/MasterHandler.java        (revision 7689)
+++ data/scripts/handlers/MasterHandler.java        (working copy)
@@ -30,6 +30,7 @@
import handlers.actionhandlers.L2SummonAction;
import handlers.actionhandlers.L2SummonActionShift;
import handlers.actionhandlers.L2TrapAction;
+import handlers.admincommandhandlers.AdminAIO;
import handlers.admincommandhandlers.AdminAdmin;
import handlers.admincommandhandlers.AdminAnnouncements;
import handlers.admincommandhandlers.AdminBBS;
@@ -297,6 +298,7 @@

        private static void loadAdminHandlers()
        {
+                AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminAIO());
                AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminAdmin());
                AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminAnnouncements());
                AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminBan());
Index: data/scripts/handlers/admincommandhandlers/AdminAIO.java
===================================================================
--- data/scripts/handlers/admincommandhandlers/AdminAIO.java        (revision 0)
+++ data/scripts/handlers/admincommandhandlers/AdminAIO.java        (revision 0)
@@ -0,0 +1,266 @@
+/*
+ * 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 handlers.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.l2jserver.L2DatabaseFactory;
+import com.l2jserver.gameserver.datatables.SkillTable;
+import com.l2jserver.gameserver.handler.IAdminCommandHandler;
+import com.l2jserver.gameserver.model.L2Object;
+import com.l2jserver.gameserver.model.L2Skill;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+public class AdminAIO implements IAdminCommandHandler
+{
+        private static Logger _log = Logger.getLogger(AdminAIO.class.getName());
+       
+        private static final String[] ADMIN_COMMANDS = { "admin_addaio", "admin_removeaio" };
+       
+        public boolean useAdminCommand(String command, L2PcInstance activeChar)
+        {
+                if (command.startsWith("admin_addaio"))
+                {
+                        L2Object target = activeChar.getTarget();
+                        L2PcInstance player = null;
+                        if (target == null)
+                        {
+                                return false;
+                        }
+                       
+                        if (target instanceof L2PcInstance)
+                        {
+                                player = (L2PcInstance) target;
+                        }
+                        else
+                        {
+                                return false;
+                        }
+                       
+                        if (!player.isAIO())
+                        {
+                                player.setAIO(true);
+                                System.out.println(player.getObjectId());
+                                handleAIOadd(player);
+                                activeChar.sendMessage("You gave AIO Status to: " + target.getName());
+                                player.sendMessage("You are an AIO now, Congratulations!");
+                                _log.fine("" + activeChar.getName() + " gave AIO Status to " + player.getName() + "( " + player.getObjectId() + " ).");
+                                Connection con = null;
+                                try
+                                {
+                                        con = L2DatabaseFactory.getInstance().getConnection();
+                                       
+                                        PreparedStatement statement = con.prepareStatement("UPDATE characters SET aio = 1 WHERE charId = ?");
+                                        statement.setInt(1, player.getObjectId());
+                                        statement.execute();
+                                        statement.close();
+                                }
+                                catch (Exception e)
+                                {
+                                        _log.log(Level.WARNING, "Could not set AIO stats of char:", e);
+                                }
+                                finally
+                                {
+                                        L2DatabaseFactory.close(con);
+                                }
+                        }
+                        else
+                        {
+                                activeChar.sendMessage(target.getName() + ": Already have AIO Stats.");
+                        }
+                }
+                else if (command.startsWith("admin_removeaio"))
+                {
+                        L2Object target = activeChar.getTarget();
+                        L2PcInstance player = null;
+                       
+                        if (target == null)
+                        {
+                                return false;
+                        }
+                       
+                        if (target instanceof L2PcInstance)
+                        {
+                                player = (L2PcInstance) target;
+                        }
+                        else
+                        {
+                                return false;
+                        }
+                       
+                        if (player.isAIO())
+                        {
+                                player.setAIO(false);
+                                handleAIOremove(player);
+                                activeChar.sendMessage(target.getName() + " has lost the AIO Status.");
+                                player.sendMessage("You are no longer an AIO.");
+                                _log.fine("" + activeChar.getName() + " removed AIO Status from " + player.getName() + "( " + player.getObjectId() + " ).");
+                               
+                                Connection con = null;
+                                try
+                                {
+                                        con = L2DatabaseFactory.getInstance().getConnection();
+                                       
+                                        PreparedStatement statement = con.prepareStatement("UPDATE characters SET aio = 0 WHERE charId = ?");
+                                        statement.setInt(1, player.getObjectId());
+                                        statement.execute();
+                                        statement.close();
+                                }
+                                catch (Exception e)
+                                {
+                                        _log.log(Level.WARNING, "Could not set AIO status on char:", e);
+                                }
+                                finally
+                                {
+                                        L2DatabaseFactory.close(con);
+                                }
+                        }
+                        else
+                        {
+                                activeChar.sendMessage(target.getName() + ": Doesn't have AIO Status.");
+                        }
+                }
+                return true;
+        }
+       
+        public void handleAIOadd(L2PcInstance player)
+        {
+                player.addSkill(SkillTable.getInstance().getInfo(5491, 1), true); //Decrease Bow/Crossbow Atk. Spd.
+                player.addSkill(SkillTable.getInstance().getInfo(58, 55), true);//Elemental Heal
+                player.addSkill(SkillTable.getInstance().getInfo(141, 3), true);//Weapon Mastery
+                player.addSkill(SkillTable.getInstance().getInfo(142, 5), true);//Armor Mastery
+                player.addSkill(SkillTable.getInstance().getInfo(163, 1), true);//Spellcraft
+                player.addSkill(SkillTable.getInstance().getInfo(164, 3), true);//Quick Recycle
+                player.addSkill(SkillTable.getInstance().getInfo(213, 8), true);//Boost Mana
+                player.addSkill(SkillTable.getInstance().getInfo(214, 1), true);//Mana Recovery
+                player.addSkill(SkillTable.getInstance().getInfo(228, 3), true);//Fast Spell Casting
+                player.addSkill(SkillTable.getInstance().getInfo(229, 7), true);//Fast Mana Recovery
+                player.addSkill(SkillTable.getInstance().getInfo(234, 41), true);//Robe Mastery
+                player.addSkill(SkillTable.getInstance().getInfo(235, 41), true);//Robe Mastery
+                player.addSkill(SkillTable.getInstance().getInfo(244, 3), true);//Armor Mastery
+                player.addSkill(SkillTable.getInstance().getInfo(249, 42), true);//Weapon Mastery
+                player.addSkill(SkillTable.getInstance().getInfo(264, 1), true);//Song of Earth
+                player.addSkill(SkillTable.getInstance().getInfo(265, 1), true);//Song of Life
+                player.addSkill(SkillTable.getInstance().getInfo(266, 1), true);//Song of Water
+                player.addSkill(SkillTable.getInstance().getInfo(267, 1), true);//Song of Warding
+                player.addSkill(SkillTable.getInstance().getInfo(268, 1), true);//Song of Wind
+                player.addSkill(SkillTable.getInstance().getInfo(269, 1), true);//Song of Hunter
+                player.addSkill(SkillTable.getInstance().getInfo(270, 1), true);//Song of Invocation
+                player.addSkill(SkillTable.getInstance().getInfo(271, 1), true);//Dance of the Warrior
+                player.addSkill(SkillTable.getInstance().getInfo(272, 1), true);//Dance of Inspiration
+                player.addSkill(SkillTable.getInstance().getInfo(273, 1), true);//Dance of the Mystic
+                player.addSkill(SkillTable.getInstance().getInfo(274, 1), true);//Dance of Fire
+                player.addSkill(SkillTable.getInstance().getInfo(275, 1), true);//Dance of Fury
+                player.addSkill(SkillTable.getInstance().getInfo(276, 1), true);//Dance of Concentration
+                player.addSkill(SkillTable.getInstance().getInfo(277, 1), true);//Dance of Light
+                player.addSkill(SkillTable.getInstance().getInfo(285, 27), true);//Higher Mana Gain
+                player.addSkill(SkillTable.getInstance().getInfo(304, 1), true);//Song of Vitality
+                player.addSkill(SkillTable.getInstance().getInfo(305, 1), true);//Song of Vengeance
+                player.addSkill(SkillTable.getInstance().getInfo(306, 1), true);//Song of Flame Guard
+                player.addSkill(SkillTable.getInstance().getInfo(307, 1), true);//Dance of Aqua Guard
+                player.addSkill(SkillTable.getInstance().getInfo(308, 1), true);//Song of Storm Guard
+                player.addSkill(SkillTable.getInstance().getInfo(309, 1), true);//Dance of Earth Guard
+                player.addSkill(SkillTable.getInstance().getInfo(310, 1), true);//Dance of the Vampire
+                player.addSkill(SkillTable.getInstance().getInfo(311, 1), true);//Dance of Protection
+                player.addSkill(SkillTable.getInstance().getInfo(329, 1), true);//Health
+                player.addSkill(SkillTable.getInstance().getInfo(331, 1), true);//Skill Mastery
+                player.addSkill(SkillTable.getInstance().getInfo(349, 1), true);//Song of Renewal
+                player.addSkill(SkillTable.getInstance().getInfo(363, 1), true);//Song of Meditation
+                player.addSkill(SkillTable.getInstance().getInfo(364, 1), true);//Song of Champion
+                player.addSkill(SkillTable.getInstance().getInfo(365, 1), true);//Siren's Dance
+                player.addSkill(SkillTable.getInstance().getInfo(366, 1), true);//Dance of Shadows
+                player.addSkill(SkillTable.getInstance().getInfo(367, 1), true);//Dance of Medusa
+                player.addSkill(SkillTable.getInstance().getInfo(437, 1), true);//Song of Silence
+                player.addSkill(SkillTable.getInstance().getInfo(1011, 18), true);//Heal
+                player.addSkill(SkillTable.getInstance().getInfo(1013, 32), true);//Recharge
+                player.addSkill(SkillTable.getInstance().getInfo(1016, 9), true);//Resurrection
+                player.addSkill(SkillTable.getInstance().getInfo(1027, 15), true);//Group Heal
+                player.addSkill(SkillTable.getInstance().getInfo(1032, 3), true);//Invigor
+                player.addSkill(SkillTable.getInstance().getInfo(1035, 4), true);//Mental Shield
+                player.addSkill(SkillTable.getInstance().getInfo(1036, 2), true);//Magic Barrier
+                player.addSkill(SkillTable.getInstance().getInfo(1040, 3), true);//Shield
+                player.addSkill(SkillTable.getInstance().getInfo(1044, 3), true);//Regeneration
+                player.addSkill(SkillTable.getInstance().getInfo(1045, 6), true);//Blessed Body
+                player.addSkill(SkillTable.getInstance().getInfo(1047, 4), true);//Mana Regeneration
+                player.addSkill(SkillTable.getInstance().getInfo(1048, 6), true);//Blessed Soul
+                player.addSkill(SkillTable.getInstance().getInfo(1059, 3), true);//Empower
+                player.addSkill(SkillTable.getInstance().getInfo(1062, 2), true);//Berserker Spirit
+                player.addSkill(SkillTable.getInstance().getInfo(1068, 3), true);//Might
+                player.addSkill(SkillTable.getInstance().getInfo(1069, 42), true);//Sleep
+                player.addSkill(SkillTable.getInstance().getInfo(1077, 3), true);//Focus
+                player.addSkill(SkillTable.getInstance().getInfo(1078, 6), true);//Concentration
+                player.addSkill(SkillTable.getInstance().getInfo(1085, 3), true);//Acumen
+                player.addSkill(SkillTable.getInstance().getInfo(1086, 2), true);//Haste
+                player.addSkill(SkillTable.getInstance().getInfo(1087, 3), true);//Agility
+                player.addSkill(SkillTable.getInstance().getInfo(1126, 6), true);//Servitor Recharge
+                player.addSkill(SkillTable.getInstance().getInfo(1127, 12), true);//Servitor Heal
+                player.addSkill(SkillTable.getInstance().getInfo(1204, 2), true);//Wind Walk
+                player.addSkill(SkillTable.getInstance().getInfo(1217, 33), true);//Greater Heal
+                player.addSkill(SkillTable.getInstance().getInfo(1218, 33), true);//Greater Battle Heal
+                player.addSkill(SkillTable.getInstance().getInfo(1219, 33), true);//Greater Group Heal
+                player.addSkill(SkillTable.getInstance().getInfo(1240, 3), true);//Guidance
+                player.addSkill(SkillTable.getInstance().getInfo(1242, 3), true);//Death Whisper
+                player.addSkill(SkillTable.getInstance().getInfo(1243, 6), true);//Bless Shield
+                player.addSkill(SkillTable.getInstance().getInfo(1254, 6), true);//Mass Resurrection
+                player.addSkill(SkillTable.getInstance().getInfo(1257, 3), true);//Decrease Weight
+                player.addSkill(SkillTable.getInstance().getInfo(1258, 4), true);//Restore Life
+                player.addSkill(SkillTable.getInstance().getInfo(1259, 4), true);//Resist Shock
+                player.addSkill(SkillTable.getInstance().getInfo(1268, 4), true);//Vampiric Rage
+                player.addSkill(SkillTable.getInstance().getInfo(1303, 2), true);//Wild Magic
+                player.addSkill(SkillTable.getInstance().getInfo(1304, 3), true);//Advanced Block
+                player.addSkill(SkillTable.getInstance().getInfo(1311, 6), true);//Body of Avatar
+                player.addSkill(SkillTable.getInstance().getInfo(1323, 1), true);//Noblesse Blessing
+                player.addSkill(SkillTable.getInstance().getInfo(1355, 1), true);//Prophecy of Water
+                player.addSkill(SkillTable.getInstance().getInfo(1356, 1), true);//Prophecy of Fire
+                player.addSkill(SkillTable.getInstance().getInfo(1357, 1), true);//Prophecy of Wind
+                player.addSkill(SkillTable.getInstance().getInfo(1363, 1), true);//Chant of Victory
+                player.addSkill(SkillTable.getInstance().getInfo(1388, 3), true);//Greater Might
+                player.addSkill(SkillTable.getInstance().getInfo(1389, 3), true);//Greater Shield
+                player.addSkill(SkillTable.getInstance().getInfo(1425, 1), true);//Purification Field
+                player.addSkill(SkillTable.getInstance().getInfo(4699, 12), true);//Blessing of Queen
+                player.addSkill(SkillTable.getInstance().getInfo(4703, 12), true);//Gift of Seraphim
+                player.addSkill(SkillTable.getInstance().getInfo(1476, 3), true);//Appetite for Destruction
+                player.addSkill(SkillTable.getInstance().getInfo(1479, 3), true);//Magic Impulse
+                player.addSkill(SkillTable.getInstance().getInfo(1478, 3), true);//Protection Instinct
+                player.sendSkillList();
+                player.broadcastUserInfo();
+        }
+       
+        public void handleAIOremove(L2PcInstance player)
+        {
+                //What if the player is buffer and we remove one of it's own skills?
+                //Let's remove all skills and give it all the skills up to it's level
+                for (L2Skill skill : player.getAllSkills())
+                {
+                        player.removeSkill(skill);
+                }
+                player.giveAvailableSkills();
+                player.sendSkillList();
+                player.broadcastUserInfo();
+        }
+       
+        public String[] getAdminCommandList()
+        {
+                return ADMIN_COMMANDS;
+        }
+}




the enxt code are for the aio buffers can not paricipate for olympiad macth:

-                if (noble.getKarma() > 0)
-                {
-               noble.sendMessage("You can't participate to Olympiad with karma.");
-              return false;
-               }
+
+                if (noble.isgold())
+                {
+                        noble.sendMessage("You can't paricipaate because you are AIO Buffer");
+                }код enxt предназначен для буферов aio, которые не могут участвовать в олимпиаде macth:

if (noble.getKarma() > 0)
-                {
-               noble.sendMessage("You can't participate to Olympiad with karma.");
-              return false;
-               }
+
+                if (noble.isgold())
+                {
+                        noble.sendMessage("You can't paricipaate because you are AIO Buffer");
+                }


вот sql для обновления, mysql такой же, как и код....
если вы знаете, как добавить больше полей в таблицы, вам не нужен этот sql..
ALTER TABLE `characters` ADD `aio` TINYINT NOT NULL DEFAULT '0' AFTER `account_name`;
INSERT INTO `l2jdb`.`admin_command_access_rights` (`adminCommand`,`accessLevels`,`confirmDlg`)
VALUES
('admin_addaio', '1', 'false'),
('admin_removeaio', '1', 'false');



Страниц: [1]
Посмотреть полную версию: Буфер AIO (команды администратора + навыки)