PC방 포인트추가

gameserver/network/clientpackets/EnterWorld.java

471~485 사이 입니다.
TvTEvent.onLogin(activeChar);

if (Config.WELCOME_MESSAGE_ENABLED)
activeChar.sendPacket(new ExShowScreenMessage(Config.WELCOME_MESSAGE_TEXT, Config.WELCOME_MESSAGE_TIME));

L2ClassMasterInstance.showQuestionMark(activeChar);

activeChar.startPCCafePointTask();

int birthday = activeChar.checkBirthDay();
if (birthday == 0)
{
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOUR_BIRTHDAY_GIFT_HAS_ARRIVED));
activeChar.sendPacket(new ExBirthdayPopup());
}

여기까지 한줄만 추가하시면 enterworld는 끝!

--------------------------------------------------------------------------------------------------------------------

다음~ gameserver/model/actor/instance/L2PcInstance.java

191~

import com.l2jserver.gameserver.network.serverpackets.ExOlympiadMode;
import com.l2jserver.gameserver.network.serverpackets.ExPCCafePointInfo; // add - PCCafePoint
import com.l2jserver.gameserver.network.serverpackets.ExPrivateStoreSetWholeMsg;

289~

// 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,pc_point) 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=?,pc_point=? 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,pc_point FROM characters WHERE charId=?";
▲여기는 자신의 소스를 보고 세줄 중에 맨 끝에 pc_point <<<관련 부분만 추가 하시고

values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";요거를

values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";요렇게 ?<<<의 갯수를 하나 늘려주셔야 합니다.

5982~

stopVitalityTask();
stopPCCafePointTask(); // add - PCCafePoint
stopRecoBonusTask();
stopRecoGiveTask();

7053~

여기서 부터 주의 할점은 36, 37, 38 등등... 기존에 숫자가 있는거에 pc포인트를 추가하는거니까 숫자를 비교해보시고 추가하시기 바랍니다.

statement.setInt(35, isNoble() ? 1 :0);
statement.setLong(36, 0);
statement.setLong(37,getCreateTime());

statement.setInt(38, getPCCafePoint()); // add - PCCafePoint

7247~

// Set Teleport Bookmark Slot
player.setBookMarkSlot(rset.getInt("BookmarkSlot"));

// Set PcPoint
player.setPCCafePoint(rset.getInt("pc_point")); // add - PCCafePoint

//character creation Time
player.setCreateTime(rset.getLong("createTime"));

7698~

statement.setInt(51, getVitalityPoints());
statement.setString(52, getLang());

statement.setInt(53, getPCCafePoint()); // add - PCCafePoint
statement.setInt(54, getObjectId());

13421~

public void gatesAnswer(int answer, int type)
{
if (_gatesRequest.getDoor() == null)
return;

if (answer == 1 && getTarget() == _gatesRequest.getDoor() && type == 1)
_gatesRequest.getDoor().openMe();
else if (answer == 1 && getTarget() == _gatesRequest.getDoor() && type == 0)
_gatesRequest.getDoor().closeMe();

_gatesRequest.setTarget(null);
}

private int _PCCafePoint = 0; <-------------- 이 부분은 케릭 생성시 초기 지급되는 피방포인트임...
protected Future<?> _PCCafePointTask = null;

public int getPCCafePoint()
{
return _PCCafePoint;
}

public void setPCCafePoint(int point)
{
_PCCafePoint = point;
}

public void startPCCafePointTask()
{
if (_PCCafePointTask == null)
_PCCafePointTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new PCCafePointTask(this), 300000, 300000); <---- 여기는 피방포인트 습득 시간 수정입니다.
sendPacket(new ExPCCafePointInfo(getPCCafePoint(), 1, 1, 10000, 0));
}

private void stopPCCafePointTask()
{
if (_PCCafePointTask != null)
{
_PCCafePointTask.cancel(false);
_PCCafePointTask = null;
}
}

class PCCafePointTask implements Runnable
{
private final L2PcInstance _player;

protected PCCafePointTask(L2PcInstance player)
{
_player = player;
}
public void run()
{
if (Rnd.get(100) > 90)
{
setPCCafePoint(getPCCafePoint() + 200);
_player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_PCPOINT_DOUBLE).addItemNumber(200));
_player.sendPacket(new ExPCCafePointInfo(getPCCafePoint(), 200, 1, 10000, 0));
}
else
{
setPCCafePoint(getPCCafePoint() + 100);
_player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_PCPOINT).addItemNumber(100));
_player.sendPacket(new ExPCCafePointInfo(getPCCafePoint(), 100, 1, 10000, 0));
}
}
}

--------------------------------------------------------------------------------------------------------------

gameserver/datatables/MultiSell.java

40~

import com.l2jserver.gameserver.network.serverpackets.ExBrExtraUserInfo;
import com.l2jserver.gameserver.network.serverpackets.ExPCCafePointInfo;
import com.l2jserver.gameserver.network.serverpackets.MultiSellList;

50~

public static final int PC_POINTS = -100;
public static final int CLAN_REPUTATION = -200;
public static final int FAME = -300;

139~

case FAME:
if (player.getFame() < amount)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_ENOUGH_FAME_POINTS));
break;
}
return true;
case PC_POINTS:
if (player.getPCCafePoint() < amount)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SHORT_OF_ACCUMULATED_POINTS));
break;
}
return true;
}
return false;


167

case FAME:
player.setFame(player.getFame() - (int)amount);
player.sendPacket(new UserInfo(player));
player.sendPacket(new ExBrExtraUserInfo(player));
return true;
case PC_POINTS:
player.setPCCafePoint(player.getPCCafePoint() - (int)amount);
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.USING_S1_PCPOINT).addItemNumber(amount));
player.sendPacket(new ExPCCafePointInfo(player.getPCCafePoint(), (int)amount*-1, 1, 10000, 0));
return true;

}
return false;
}


363~

case CLAN_REPUTATION:
case FAME:
case PC_POINTS:
return true;

----------------------------------------------------------------------------------------------------------

gameserver\data\scr!pts\handlers\itemhandlers\

폴더 안에 PCCafePoint.java <<<라는 파일을 생성합니다. 저장은 반드시 인코딩 utf-8로 저장해 주시기 바랍니다


data\scr!pts\handlers\MasterHandler.java

179~

import handlers.itemhandlers.SpiritShot;
import handlers.itemhandlers.SummonItems;
import handlers.itemhandlers.TeleportBookmark;
import handlers.itemhandlers.PCCafePoint;

431~

private static void loadItemHandlers()
{
ItemHandler.getInstance().registerItemHandler(new PCCafePoint());
ItemHandler.getInstance().registerItemHandler(new ScrollOfResurrection());
ItemHandler.getInstance().registerItemHandler(new SoulShots());

--------------------------------------------------------------------------------------------------------------

이제 어려운건 다 끝났네용^^ 이제 디비쪽 수정만 남았습니다.

나비캣에서 본인 서버의 디비를 열으신 후에 질의들<<<이라고 써있는 걸 누릅니다. 그리고 새로운 질의<<<를 누릅니다.

창이 뜨면

디비에 미리 생성되어 있는 케릭터 정보가 없을 경우에는 다음 구문을

ALTER TABLE characters ADD `pc_point` int(11) NOT NULL;

디비에 미리 생성되어 있는 케릭터 정보가 있을 경우에는 다음 구문을
ALTER TABLE characters ADD `pc_point` int(11) DEFAULT NULL;
UPDATE characters SET pc_point = '0';

써넣은 후에 동작하기<<<를 클릭 합니다.

저는 케릭 생성시 pc포인트가 0점이 지급되기 때문에 UPDATE characters SET pc_point = '0';
여기를 0으로 한거구요... 여러분은 여러분 입맛대로 숫자만 바꾸시면 됩니다.

-----------------------------------------------------------------------------------------------------------------

이제 완전히 끝났네요...

html과 멀티셀은 이제 알아서 짜시면 될꺼구요...

단 멀티셀의 pc방 포인트 아이템코드는 -100으로 넣어주시면 됩니다.

<?xml version="1.0" encoding="UTF-8"?>
<!-- 비타민 아이템 교환 -->
<!-- This list is best used in exc_multisel -->
<list maintainEnchantment="false">
<item id="1">
<production id="13239" count="1"/>
<ingredient id="-100" count="1000"/>
</item>
<item id="2">
<production id="13240" count="1"/>
<ingredient id="-100" count="1000"/>
</item>

요런식으로 

저작자 표시 비영리 동일 조건 변경 허락
신고