Support for honor points.

This commit is contained in:
MobiusDevelopment 2021-04-27 12:22:23 +00:00
parent c9e2128873
commit 45c02973b7
10 changed files with 85 additions and 4 deletions

View File

@ -25,7 +25,8 @@ public enum SpecialItemType
CLAN_REPUTATION(-200),
FAME(-300),
FIELD_CYCLE_POINTS(-400),
RAIDBOSS_POINTS(-500);
RAIDBOSS_POINTS(-500),
HONOR_POINTS(-700);
private int _clientId;

View File

@ -12916,6 +12916,16 @@ public class PlayerInstance extends Playable
_pcCafePoints = count < Config.PC_CAFE_MAX_POINTS ? count : Config.PC_CAFE_MAX_POINTS;
}
public long getHonorPoints()
{
return getVariables().getLong("HONOR_POINTS", 0);
}
public void setHonorPoints(long value)
{
getVariables().set("HONOR_POINTS", value);
}
/**
* Check all player skills for skill level. If player level is lower than skill learn level - 9, skill level is decreased to next possible level.
*/

View File

@ -359,6 +359,10 @@ public class TeleportHolder
{
return "Raid Points";
}
case HONOR_POINTS:
{
return "Honor Points";
}
}
}
return "Unknown item: " + itemId;

View File

@ -218,7 +218,6 @@ public class MultiSellChoose implements IClientIncomingPacket
player.sendPacket(SystemMessageId.YOU_ARE_NOT_A_CLAN_MEMBER_AND_CANNOT_PERFORM_THIS_ACTION);
return;
}
continue;
}
@ -366,6 +365,11 @@ public class MultiSellChoose implements IClientIncomingPacket
player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), (int) -totalCount, 1));
break;
}
case HONOR_POINTS:
{
player.setHonorPoints(player.getHonorPoints() - totalCount);
break;
}
default:
{
LOGGER.severe("Character: " + player.getName() + " has suffered possible item loss by using multisell " + _listId + " which has non-implemented special ingredient with id: " + ingredient.getId() + ".");
@ -464,6 +468,11 @@ public class MultiSellChoose implements IClientIncomingPacket
player.sendPacket(new UserInfo(player));
break;
}
case HONOR_POINTS:
{
player.setHonorPoints(player.getHonorPoints() + totalCount);
break;
}
default:
{
LOGGER.severe("Character: " + player.getName() + " has suffered possible item loss by using multisell " + _listId + " which has non-implemented special product with id: " + product.getId() + ".");
@ -656,6 +665,15 @@ public class MultiSellChoose implements IClientIncomingPacket
}
return true;
}
case HONOR_POINTS:
{
if (player.getHonorPoints() < totalCount)
{
player.sendMessage("You are short of Honor Points.");
return false;
}
return true;
}
default:
{
LOGGER.severe("Multisell: " + _listId + " is using a non-implemented special ingredient with id: " + ingredientId + ".");

View File

@ -25,7 +25,8 @@ public enum SpecialItemType
CLAN_REPUTATION(-200),
FAME(-300),
FIELD_CYCLE_POINTS(-400),
RAIDBOSS_POINTS(-500);
RAIDBOSS_POINTS(-500),
HONOR_POINTS(-700);
private int _clientId;

View File

@ -12874,6 +12874,16 @@ public class PlayerInstance extends Playable
_pcCafePoints = count < Config.PC_CAFE_MAX_POINTS ? count : Config.PC_CAFE_MAX_POINTS;
}
public long getHonorPoints()
{
return getVariables().getLong("HONOR_POINTS", 0);
}
public void setHonorPoints(long value)
{
getVariables().set("HONOR_POINTS", value);
}
/**
* Check all player skills for skill level. If player level is lower than skill learn level - 9, skill level is decreased to next possible level.
*/

View File

@ -359,6 +359,10 @@ public class TeleportHolder
{
return "Raid Points";
}
case HONOR_POINTS:
{
return "Honor Points";
}
}
}
return "Unknown item: " + itemId;

View File

@ -218,7 +218,6 @@ public class MultiSellChoose implements IClientIncomingPacket
player.sendPacket(SystemMessageId.YOU_ARE_NOT_A_CLAN_MEMBER_AND_CANNOT_PERFORM_THIS_ACTION);
return;
}
continue;
}
@ -366,6 +365,11 @@ public class MultiSellChoose implements IClientIncomingPacket
player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), (int) -totalCount, 1));
break;
}
case HONOR_POINTS:
{
player.setHonorPoints(player.getHonorPoints() - totalCount);
break;
}
default:
{
LOGGER.severe("Character: " + player.getName() + " has suffered possible item loss by using multisell " + _listId + " which has non-implemented special ingredient with id: " + ingredient.getId() + ".");
@ -464,6 +468,11 @@ public class MultiSellChoose implements IClientIncomingPacket
player.sendPacket(new UserInfo(player));
break;
}
case HONOR_POINTS:
{
player.setHonorPoints(player.getHonorPoints() + totalCount);
break;
}
default:
{
LOGGER.severe("Character: " + player.getName() + " has suffered possible item loss by using multisell " + _listId + " which has non-implemented special product with id: " + product.getId() + ".");
@ -656,6 +665,15 @@ public class MultiSellChoose implements IClientIncomingPacket
}
return true;
}
case HONOR_POINTS:
{
if (player.getHonorPoints() < totalCount)
{
player.sendMessage("You are short of Honor Points.");
return false;
}
return true;
}
default:
{
LOGGER.severe("Multisell: " + _listId + " is using a non-implemented special ingredient with id: " + ingredientId + ".");

View File

@ -20,6 +20,7 @@ import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.commons.util.Chronos;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.data.xml.LCoinShopData;
import org.l2jmobius.gameserver.enums.SpecialItemType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.PrimeShopRequest;
import org.l2jmobius.gameserver.model.holders.LCoinShopProductHolder;
@ -124,6 +125,15 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
return;
}
}
else if (product.getIngredientIds()[i] == SpecialItemType.HONOR_POINTS.getClientId())
{
if (player.getHonorPoints() < (product.getIngredientQuantities()[i] * _amount))
{
player.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
player.removeRequest(PrimeShopRequest.class);
return;
}
}
else if (player.getInventory().getInventoryItemCount(product.getIngredientIds()[i], -1, true) < (product.getIngredientQuantities()[i] * _amount))
{
player.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
@ -143,6 +153,10 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
{
player.reduceAdena("LCoinShop", product.getIngredientQuantities()[i] * _amount, player, true);
}
else if (product.getIngredientIds()[i] == SpecialItemType.HONOR_POINTS.getClientId())
{
player.setHonorPoints(player.getHonorPoints() - (product.getIngredientQuantities()[i] * _amount));
}
else
{
player.destroyItemByItemId("LCoinShop", product.getIngredientIds()[i], product.getIngredientQuantities()[i] * _amount, player, true);

View File

@ -54,6 +54,7 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
_products = LCoinShopSpecialCraftData.getInstance().getProducts();
break;
}
case 100: // Clan Shop
default:
{
_products = LCoinShopData.getInstance().getProducts();