Jump to content
  • 0

Custom Zone (Random Race Display)


Question

Posted (edited)

Hello.

 

I created a custom zone. And I edited the charinfo, so when a player enters the zone his/her name will be "Unknown".

 

However, my problem is that the system damage message still displays the original name of the characters. (I guess becuase the changes in charinfo only affect the client and the server still recognize the character's origianl name).

 

My question is: what should I edit or change in order to have the system message display "unknown" instead of the original names?

 

I know i could create new system messsages (instead of $c1 done $s3 damge $c2 to unknown done $s3 damage to unknown) but I'd rather avoid this if theres a better way.

 

 

EDIT:

 

Does anybody have any suggestion, ideas how could I make  Random Race displayed in a specific zone for players?

 

Either in Charinfo, or some other working method would be great.

 

Thank you.

 

 

P.S: Im using High Five latest rev.

Edited by Horse

Recommended Posts

  • 0
Posted

Search for the msg sent and edit the msg. Add a check about your zone, if inside send 'unknown', otherwise name (as it is) or simply another msg (your example) if inside. No other way.

  • 0
Posted

Search for the msg sent and edit the msg. Add a check about your zone, if inside send 'unknown', otherwise name (as it is) or simply another msg (your example) if inside. No other way.

Yea, this was my original idea as well. But I was wondering if there was a way to change the name serverside while the player is in the specified zone.

 

 

 

Also, I'd have an other question.

 

How can I  make the chars have random race in that zone?

 

I was thinking of a simalier method to add a check at the    writeD(_activeChar.getRace().ordinal());  But I'm not sure how can i change this in order to have a random race displayed.

  • 0
Posted (edited)

Thanks for the answers, guys yea either rnd.get or other random seems to be fine.

 

But the problem is I don't know what should I add in the writeD(    to get  a specified race to displayed.

Edited by Horse
  • 0
Posted

disable chat maybe? or you need that?

Disable chat, auto change names to unknown or something, random sex------These I've already done.

 

What i need is a method to change randomly the race displayed to others when you enter this zone.  For exemple: You are an "elf male" but when you enter that zone the others will see an other random template like orc female, human male, etc etc.

 

 

I even tried to adopt the method used in nexus antifeed protection, but for some reason it doesn't seem to work,, no errors in eclipse and yet it doesnt change the races.

  • 0
Posted

Disable chat, auto change names to unknown or something, random sex------These I've already done.

 

What i need is a method to change randomly the race displayed to others when you enter this zone.  For exemple: You are an "elf male" but when you enter that zone the others will see an other random template like orc female, human male, etc etc.

 

 

I even tried to adopt the method used in nexus antifeed protection, but for some reason it doesn't seem to work,, no errors in eclipse and yet it doesnt change the races.

ohhh i see , you want it visual not to make them all such a race and after leaving back to the old!.. So can i see the code of nexus anti feed?

  • 0
Posted

Search for the msg sent and edit the msg. Add a check about your zone, if inside send 'unknown', otherwise name (as it is) or simply another msg (your example) if inside. No other way.

 

No way, you will need to edit wherever it's needed.

 

Rework directly addCharName or addPcName from SystemMessage, which will affect every single case.

  • 0
Posted

ohhh i see , you want it visual not to make them all such a race and after leaving back to the old!.. So can i see the code of nexus anti feed?

    private L2PcTemplate _antifeedTemplate = null;
    private boolean _antifeedSex;
    
    private L2PcTemplate createRandomAntifeedTemplate()
    {
        Race race = null;
        
        while(race == null)
        {
            race = Race.values()[Rnd.get(Race.values().length)];
            if(race == getRace() || race == Race.KAMAEL)
                race = null;
        }
        
        PlayerClass p;
        for(ClassId c : ClassId.values())
        {
            p = PlayerClass.values()[c.getId()];
            if(p.isOfRace(race) && p.isOfLevel(ClassLevel.Fourth))
            {
                _antifeedTemplate = PlayerTemplateData.getInstance().getTemplate(c);
                break;
            }
        }
        
        if(getRace() == Race.KAMAEL)
            _antifeedSex = getAppearance().getSex();
        
        _antifeedSex = Rnd.get(2) == 0 ? true : false;
        
        return _antifeedTemplate;
    }
    
    public void startAntifeedProtection(boolean start, boolean broadcast)
    {
        if(!start)
        {
            getAppearance().setVisibleName(getName());
            _antifeedTemplate = null;
        }
        else
        {
            getAppearance().setVisibleName("Unknown");
            createRandomAntifeedTemplate();
        }
    }
    
    public L2PcTemplate getAntifeedTemplate()
    {
        return _antifeedTemplate;
    }
    
    public boolean getAntifeedSex()
    {
        return _antifeedSex;
    }


The L2PcInstance.

 

 

The CharInfo:

			writeD(_objId);

			if (_activeChar.isInsideZone(ZoneId.PVP))
			{
				writeS("Unknown"); // visible name
				
				writeD(_activeChar.getAntifeedTemplate().getRace().ordinal()); // race
				writeD(_activeChar.getAntifeedSex() ? 0 : 1); // sex

				writeD(_activeChar.getAntifeedTemplate().getClassId().getId()); // class
			}
			else
			{
				writeS(_activeChar.getAppearance().getVisibleName());
				writeD(_activeChar.getRace().ordinal());
				writeD(_activeChar.getAppearance().getSex() ? 1 : 0);
				
				if (_activeChar.getClassIndex() == 0)
					writeD(_activeChar.getClassId().getId());
				else
					writeD(_activeChar.getBaseClass());
			}

			
			for (int slot : getPaperdollOrder())
			{
				writeD(_activeChar.getInventory().getPaperdollItemDisplayId(slot));
			}
			
			for (int slot : getPaperdollOrder())
			{
				writeD(_activeChar.getInventory().getPaperdollAugmentationId(slot));
			}
			
			writeD(_activeChar.getInventory().getTalismanSlots());
			writeD(_activeChar.getInventory().canEquipCloak() ? 1 : 0);
			
			writeD(_activeChar.getPvpFlag());
			writeD(_activeChar.getKarma());
			
			writeD(_mAtkSpd);
			writeD(_pAtkSpd);
			
			writeD(0x00); // ?
			
			writeD(_runSpd);
			writeD(_walkSpd);
			writeD(_swimRunSpd);
			writeD(_swimWalkSpd);
			writeD(_flyRunSpd);
			writeD(_flyWalkSpd);
			writeD(_flyRunSpd);
			writeD(_flyWalkSpd);
			writeF(_moveMultiplier);
			writeF(_activeChar.getAttackSpeedMultiplier());
			
			if (_activeChar.isInsideZone(ZoneId.PVP))
        	{
				if(_activeChar.getAntifeedSex())
				{
					writeF(_activeChar.getAntifeedTemplate().getFCollisionRadiusFemale());
            		writeF(_activeChar.getAntifeedTemplate().getFCollisionHeightFemale());
				}
				else
				{
					writeF(_activeChar.getAntifeedTemplate().getfCollisionRadius());
            		writeF(_activeChar.getAntifeedTemplate().getfCollisionHeight());
				}
        	}
        	else
        	{
        		writeF(_activeChar.getCollisionRadius());
				writeF(_activeChar.getCollisionHeight());
        	}
			
			if (_activeChar.isInsideZone(ZoneId.PVP))
			{
				writeD(0);
				writeD(0);
				writeD(0);
			}
			else
			{
				writeD(_activeChar.getAppearance().getHairStyle());
				writeD(_activeChar.getAppearance().getHairColor());
				writeD(_activeChar.getAppearance().getFace());
			}
			
			if (_activeChar.isInsideZone(ZoneId.PVP))
				writeS("");
			else
				writeS(gmSeeInvis ? "Invisible" : _activeChar.getAppearance().getVisibleTitle());
			
			if (!_activeChar.isCursedWeaponEquipped() && !_activeChar.isInsideZone(ZoneId.PVP))
			{
				writeD(_activeChar.getClanId());
				writeD(_activeChar.getClanCrestId());
				writeD(_activeChar.getAllyId());
				writeD(_activeChar.getAllyCrestId());
			}
			else
			{
				writeD(0x00);
				writeD(0x00);
				writeD(0x00);
				writeD(0x00);
			}
			
			writeC(_activeChar.isSitting() ? 0 : 1); // standing = 1 sitting = 0
			writeC(_activeChar.isRunning() ? 1 : 0); // running = 1 walking = 0
			writeC(_activeChar.isInCombat() ? 1 : 0);
			
			writeC(!_activeChar.isInOlympiadMode() && _activeChar.isAlikeDead() ? 1 : 0);
			
			writeC(!gmSeeInvis && isInvisible() ? 1 : 0); // invisible = 1 visible =0
			
			writeC(_activeChar.getMountType().ordinal()); // 1-on Strider, 2-on Wyvern, 3-on Great Wolf, 0-no mount
			writeC(_activeChar.getPrivateStoreType().getId());
			
			writeH(_activeChar.getCubics().size());
			for (int cubicId : _activeChar.getCubics().keySet())
			{
				writeH(cubicId);
			}
			
			writeC(_activeChar.isInPartyMatchRoom() ? 1 : 0);
			
			writeD(gmSeeInvis ? (_activeChar.getAbnormalVisualEffects() | AbnormalVisualEffect.STEALTH.getMask()) : _activeChar.getAbnormalVisualEffects());
			
			writeC(_activeChar.isInsideZone(ZoneId.WATER) ? 1 : _activeChar.isFlyingMounted() ? 2 : 0);
			
			if (_activeChar.isInsideZone(ZoneId.PVP))
			{
				writeH(0);
			}
			else
			{
				writeH(_activeChar.getRecomHave()); //Blue value for name (0 = white, 255 = pure blue)
			}
			
			writeD(_activeChar.getMountNpcId() + 1000000);
			
			if (_activeChar.isInsideZone(ZoneId.PVP))
				writeD(_activeChar.getAntifeedTemplate().getClassId().getId());
			else
				writeD(_activeChar.getClassId().getId());
			
			writeD(0x00); // ?
			writeC(_activeChar.isMounted() ? 0 : _activeChar.getEnchantEffect());
			
			writeC(_activeChar.getTeam().getId());
			
			if (_activeChar.isInsideZone(ZoneId.PVP))
	        {
	        	writeD(0);
				writeC(1); // Symbol on char menu ctrl+I
				writeC(0); // Hero Aura
	        }
	        else
	        {
	        	writeD(_activeChar.getClanCrestLargeId());
				writeC(_activeChar.isNoble() ? 1 : 0); // Symbol on char menu ctrl+I
				writeC(_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) ? 1 : 0); // Hero Aura
			}
			
			writeC(_activeChar.isFishing() ? 1 : 0); // 0x01: Fishing Mode (Cant be undone by setting back to 0)
			writeD(_activeChar.getFishx());
			writeD(_activeChar.getFishy());
			writeD(_activeChar.getFishz());
			
			if (_activeChar.isInsideZone(ZoneId.PVP))
			{
				writeD(0xFFFFFF);
			}
			else
			{
				writeD(_activeChar.getAppearance().getNameColor());
			}
			
			writeD(_heading);
			
			writeD(_activeChar.getPledgeClass());
			writeD(_activeChar.getPledgeType());
			
			if (_activeChar.isInsideZone(ZoneId.PVP))
			{
	        	writeD(0xFFFF77);
			}
			else
			{
				writeD(_activeChar.getAppearance().getTitleColor());
			}
			

After reading the the erros that popped up in the gameserver panel. It seems to have some problem with the antifeedgetAntifeedTemplate

  • 0
Posted

No way, you will need to edit wherever it's needed.

 

Rework directly addCharName or addPcName from SystemMessage, which will affect every single case.

Yep, that's what I did.

  • 0
Posted (edited)

http://stackoverflow.com/questions/1972392/java-pick-a-random-value-from-an-enum and use Rnd.get

 

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

Rnd.get(2) == 0 ? true : false; 

Rnd.nextBoolean();

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

 

You miss NPE check on getAntifeedTemplate() uses.

Edited by Tryskell
  • 0
Posted

http://stackoverflow.com/questions/1972392/java-pick-a-random-value-from-an-enum and use Rnd.get

 

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

Rnd.get(2) == 0 ? true : false; 

Rnd.nextBoolean();

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

 

You miss NPE check on getAntifeedTemplate() uses.

 

I got the Rnd part thanks.

 

But about the null pointer exception check, I'm not so sure.

 

Could you explain me what or how could i apply an npe check to the getAntifeedTemplate() ?

  • 0
Posted
getAntifeedTemplate() != null 

wherever it's needed, because it is null the majority of time, and not null only for events. As you use the packets both for events and regular, it needs a null check, until you initialize it with a default template and avoids to null it after the event as you currently do.

 

PS : easiest would be to initialize and get same template for everyone. That avoid your do/while loop for race, that avoid to generate shitloads amount of pointless templates, that avoid to get NPE checks. You initialize a static template and refers to it everytime you need it ; can't be null, single object, best performance.

Guest
This topic is now closed to further replies.


  • Posts

    • https://www.4shared.com/s/fyGGySJVvfa  
    • PAYPAL& BINANCE PAYPAL& BINANCE
    • SOCNET STORE — is a unique place where you can find everything you need for your work on the Internet!   We offer the following range of products and services: Verified accounts with blue tick marks and confirmed documents in Instagram, Facebook, Twitter (X), LinkedIn; Gift cards and premium subscriptions for your services (Instagram Meta, Facebook Meta, Discord Nitro, Telegram Premium, YouTube Premium, Spotify Premium, ChatGPT, Netflix Premium, LinkedIn Premium, Twitter Premium, etc.); Telegram bot for purchasing Telegram Stars with a minimum markup with automatic delivery; Replenishment of your advertising accounts (in TikTok ADS, Facebook ADS, Google ADS, Bing ADS) + linking a bank card; Payment for any other service or subscription with a markup from 5 to 25% (depending on the cost of the subscription) Available payment methods: via PayPal, any cryptocurrency (+Binance Pay), Telegram Stars, Cash App, or any bank card.    Our online store  SOCNET.STORE  Our Telegram Stars Bot  SOCNET.CC  Our SMM-Panel for social media promotion  SOCNET.PRO  Telegram store  SOCNET.SHOP    News:  ➡ Telegram channel ➡ WhatsApp channel ➡ Discord server  Contacts and support:  ➡ Telegram support ➡ WhatsApp support ➡ Discord support: socnet_support ➡ Email support: solomonbog@socnet.store We have been operating for a long time and have gathered a huge list of reviews about our work! Our large list of positive and honest reviews is presented on our website!   VERIFIED ACCOUNTS    Verified old Instagram Meta account (2010-2020) with an active blue checkmark | Subscription has already been paid for 1 month in advance, account confirmed by documents: from $70 Verified old Facebook Meta account (2010-2023) with an active blue checkmark | Subscription has already been paid for 1 month in advance, account confirmed by documents: from $70 Verified Linkedin account (2010-2024) with an active checkmark and confirmed documents | Checkmark does not require renewal: from $80 Verified old Twitter (X) account (2010-2022) with an active blue checkmark | GEO: Tier 1-3 (your choice) | Subscription has already been paid for 1 month in advance: from $16    TELEGRAM STARS    Telegram Stars | 1 star from $0.0175 | Discounts for bulk orders | Delivery within 1-2 minutes automatically    GIFT SERVICES & PREMIUM SUBSCRIPTIONS  DISCORD NITRO Discord Nitro Classic (Basic) GIFT | 1/12 MONTHS | NO LOGIN OR PASSWORD NEEDED | Full subscription guarantee | Price from: $3.15 Discord Nitro FULL | 1/12 MONTHS | NO LOGIN OR PASSWORD NEEDED | Full subscription guarantee | Price from: $6.8 SPOTIFY PREMIUM Individual Spotify Premium plan for 1 month ON YOUR ACCOUNT | Available worldwide | Price from: $2.49 Family Spotify Premium plan for 1 month ON YOUR ACCOUNT | Works in any country | Price from: $3.75 Personal YouTube Premium Music on your account | 1 month | Ad-free YouTube | Price from: $3.75 Family YouTube Premium Music on your account | 1 month | Ad-free YouTube | Price from: $4.35 TELEGRAM PREMIUM Telegram Premium subscription for 1 month on your account | Authorization required (via TDATA or phone number) | Price from: $6 Telegram Premium subscription for 3 months on your account | No account authorization required | Guaranteed for full period | Price from: $17 Telegram Premium subscription for 6 months on your account | No account authorization required | Guaranteed for full period | Price from: $22 Telegram Premium subscription for 12 months on your account | No account authorization required | Guaranteed for full period | Price from: $37 GOOGLE VOICE • Google Voice Accounts (GMAIL US NEW) | Age/Year: Random 2024 | Phone Verified: Yes | Price from: $13 TWITTER(X) PREMIUM • Twitter Premium X subscription on your Twitter account for 1 month/1 year (your choice). Authorization in your Twitter account is required. Price from: $13 per month • Twitter X Premium Plus subscription with GROK AI on your Twitter account for 1 month/1 year (your choice). Authorization in your Twitter account is required. Price from: $55 NETFLIX PREMIUM • Netflix Premium subscription for 1 month on your personal account for any country, renewable after expiration | Price from: $10 CANVA PRO • CANVA PRO subscription for 1 month via invitation to your email | Price from: $1 CHATGPT 5 • Shared ChatGPT 5 Plus account FOR 2/5 USERS | Price from: $5 / $10 • Group ChatGPT 5 Plus subscription on your own email address for 1 month | Price from: $5 • Personal ChatGPT 5 Plus account FOR 1 USER or CHAT GPT PLUS subscription on your own account | Price from: $18 • ChatGPT 5 PRO account with UNLIMITED REQUESTS | Dedicated personal account FOR 1 USER ONLY or ON YOUR ACCOUNT | Works in any country or region | Price from: $220 Payment for any other subscription and replenishment of advertising accounts: Additional 5–20% to the cost of the subscription on the site or to the replenishment amount depending on the total purchase amount.   Attention: This text block does not represent our full product range; for more details, please visit the relevant links below! If you have any questions, our support team is always ready to help!       Our online store  SOCNET.STORE  Our Telegram Stars Bot  SOCNET.CC  Our SMM-Panel for social media promotion  SOCNET.PRO  Telegram store  SOCNET.SHOP    News:  ➡ Telegram channel ➡ WhatsApp channel ➡ Discord server  Contacts and support:  ➡ Telegram support ➡ WhatsApp support ➡ Discord support: socnet_support ➡ Email support: solomonbog@socnet.store We have been operating for a long time and have gathered a huge list of reviews about our work! Our large list of positive and honest reviews is presented on our website!  10% – 20% Discount or $1 BONUS for your registration  If you’d like to receive a $1 BONUS for your registration OR a DISCOUNT of 10% – 20% on your first purchase, simply leave a comment: "SEND ME MY BONUS, MY USERNAME IS..." You can also use the ready promo code across all our stores: "SOCNET" (15% discount!)  We invite you to COOPERATE and EARN with us  Want to sell your product or service in our stores and earn money? Want to become our partner or propose a mutually beneficial collaboration? You can contact us through the CONTACTS listed in this thread. Frequently Asked Questions and Refund Policy If you have any questions or issues, our fast customer support is always ready to respond to your requests! Refunds for services that do not fully meet the stated requirements or quality will only be issued if a guarantee and duration are explicitly mentioned in the product description. In all other cases, refunds will not be fully processed! By purchasing such services, you automatically agree to our refund policy for non-provided services. We currently accept CRYPTOMUS, Payeer, NotPayments, Perfect Money, Russian and Ukrainian bank cards, AliPay, BinancePay, CryptoBot, credit cards, and PayPal. The $1 registration bonus can only be used for purchases and only once after your first registration in any SOCNET project. We value every customer and provide replacements in case of invalid accounts through our contact methods! p.s.: Purchase bonuses can be used across any SOCNET projects: web store or Telegram bots.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock