EQEmuUser
05-19-2015, 12:41 PM
I've recently been playing on the P99 server, and I came across some issues with the faction value ranges. I decided to look into it more and thought I'd look at the actual EQEmu source code to see what was going on.
It appears that neither EQEmu, nor P99, use the actual faction ranges that I have always associated with EQ.
I'd like to refer you to some links on the P99 wiki.
http://wiki.project1999.com/Faction
http://wiki.project1999.com/Talk:Faction
As you can see, faction was originally handled directly in the EQ client. The ranges were clear.
Did they yank the faction handling code from the client at some point, and start passing down a packet that told you how you con'd to a mob?
Is this why EQEmu's ranges differ so much, were the devs just guessing at what the real ranges were?
I'd like to understand better how the current EQEmu faction ranges were determined.
Secrets
05-19-2015, 05:30 PM
I managed to find an old copy of EQEmu 0.3.13 that I had lying around from 2002. I looked at that faction code and it also has the same values as in the current faction.cpp. So, it looks like EQEmu has always used these odd numbers.
I guess my question is, do the current devs understand that there is this major conflict or do they already know about the issue and just live with it because of the amount of work that it would take to make the faction_list table correct?
Or, was there actual testing done to make sure that the faction ranges that EQEmu is using are correct?
If testing was done, how was the issue resolved that the executable clearly lists different values than what the testing turned up?
Would it be any help to have the assembly from the executable posted?
Yes, faction from an executable that had it saved clientsided would help. I'd be interested in seeing that.
P99 and Live-like faction values are different, though. Keep in mind there was no ally until Velious, so anything prior to 2001 would be incorrect for modern day EQ.
EQEmuUser
05-20-2015, 12:33 PM
Here is the assembly form the original release CD executable:
.text:004D8380 loc_4D8380: ; CODE XREF: sub_4D8340+32j
.text:004D8380 xor eax, eax
.text:004D8382 push edi
.text:004D8383 mov al, [esi+98h]
.text:004D8389 sub eax, 0
.text:004D838C jz short loc_4D83D1
.text:004D838E dec eax
.text:004D838F lea esi, [esp+428h+var_410]
.text:004D8393 jz short loc_4D83B3
.text:004D8395 mov edi, offset aIt ; "it"
.text:004D839A or ecx, 0FFFFFFFFh
.text:004D839D xor eax, eax
.text:004D839F mov [esp+428h+var_418], esi
.text:004D83A3 repne scasb
.text:004D83A5 not ecx
.text:004D83A7 sub edi, ecx
.text:004D83A9 mov esi, edi
.text:004D83AB mov edi, [esp+428h+var_418]
.text:004D83AF mov eax, ecx
.text:004D83B1 jmp short loc_4D83F1
.text:004D83B3 ; ---------------------------------------------------------------------------
.text:004D83B3
.text:004D83B3 loc_4D83B3: ; CODE XREF: sub_4D8340+53j
.text:004D83B3 mov edi, offset aShe ; "she"
.text:004D83B8 or ecx, 0FFFFFFFFh
.text:004D83BB xor eax, eax
.text:004D83BD mov [esp+428h+var_418], esi
.text:004D83C1 repne scasb
.text:004D83C3 not ecx
.text:004D83C5 sub edi, ecx
.text:004D83C7 mov esi, edi
.text:004D83C9 mov edi, [esp+428h+var_418]
.text:004D83CD mov eax, ecx
.text:004D83CF jmp short loc_4D83F1
.text:004D83D1 ; ---------------------------------------------------------------------------
.text:004D83D1
.text:004D83D1 loc_4D83D1: ; CODE XREF: sub_4D8340+4Cj
.text:004D83D1 mov edi, offset aHe ; "he"
.text:004D83D6 or ecx, 0FFFFFFFFh
.text:004D83D9 xor eax, eax
.text:004D83DB lea esi, [esp+428h+var_410]
.text:004D83DF repne scasb
.text:004D83E1 not ecx
.text:004D83E3 sub edi, ecx
.text:004D83E5 mov [esp+428h+var_418], esi
.text:004D83E9 mov esi, edi
.text:004D83EB mov edi, [esp+428h+var_418]
.text:004D83EF mov eax, ecx
.text:004D83F1
.text:004D83F1 loc_4D83F1: ; CODE XREF: sub_4D8340+71j
.text:004D83F1 ; sub_4D8340+8Fj
.text:004D83F1 shr ecx, 2
.text:004D83F4 rep movsd
.text:004D83F6 mov ecx, eax
.text:004D83F8 and ecx, 3
.text:004D83FB rep movsb
.text:004D83FD mov ecx, [esp+428h+arg_4]
.text:004D8404 mov al, [ecx+94h]
.text:004D840A test al, al
.text:004D840C jnz short loc_4D8412
.text:004D840E xor eax, eax
.text:004D8410 jmp short loc_4D8419
.text:004D8412 ; ---------------------------------------------------------------------------
.text:004D8412
.text:004D8412 loc_4D8412: ; CODE XREF: sub_4D8340+CCj
.text:004D8412 mov eax, [esp+428h+arg_8]
.text:004D8419
.text:004D8419 loc_4D8419: ; CODE XREF: sub_4D8340+D0j
.text:004D8419 cmp eax, 750
.text:004D841E jl short loc_4D8448
.text:004D8420 mov edi, offset aLooksUponYouWa ; "looks upon you warmly"
.text:004D8425 or ecx, 0FFFFFFFFh
.text:004D8428 xor eax, eax
.text:004D842A lea esi, [esp+428h+var_300]
.text:004D8431 repne scasb
.text:004D8433 not ecx
.text:004D8435 sub edi, ecx
.text:004D8437 mov [esp+428h+var_418], esi
.text:004D843B mov esi, edi
.text:004D843D mov edi, [esp+428h+var_418]
.text:004D8441 mov eax, ecx
.text:004D8443 jmp loc_4D856E
.text:004D8448 ; ---------------------------------------------------------------------------
.text:004D8448
.text:004D8448 loc_4D8448: ; CODE XREF: sub_4D8340+DEj
.text:004D8448 cmp eax, 500
.text:004D844D jl short loc_4D8477
.text:004D844F mov edi, offset aKindlyConsider ; "kindly considers you"
.text:004D8454 or ecx, 0FFFFFFFFh
.text:004D8457 xor eax, eax
.text:004D8459 lea esi, [esp+428h+var_300]
.text:004D8460 repne scasb
.text:004D8462 not ecx
.text:004D8464 sub edi, ecx
.text:004D8466 mov [esp+428h+var_418], esi
.text:004D846A mov esi, edi
.text:004D846C mov edi, [esp+428h+var_418]
.text:004D8470 mov eax, ecx
.text:004D8472 jmp loc_4D856E
.text:004D8477 ; ---------------------------------------------------------------------------
.text:004D8477
.text:004D8477 loc_4D8477: ; CODE XREF: sub_4D8340+10Dj
.text:004D8477 cmp eax, 100
.text:004D847A jl short loc_4D84A4
.text:004D847C mov edi, offset aJudgesYouAmiab ; "judges you amiably"
.text:004D8481 or ecx, 0FFFFFFFFh
.text:004D8484 xor eax, eax
.text:004D8486 lea esi, [esp+428h+var_300]
.text:004D848D repne scasb
.text:004D848F not ecx
.text:004D8491 sub edi, ecx
.text:004D8493 mov [esp+428h+var_418], esi
.text:004D8497 mov esi, edi
.text:004D8499 mov edi, [esp+428h+var_418]
.text:004D849D mov eax, ecx
.text:004D849F jmp loc_4D856E
.text:004D84A4 ; ---------------------------------------------------------------------------
.text:004D84A4
.text:004D84A4 loc_4D84A4: ; CODE XREF: sub_4D8340+13Aj
.text:004D84A4 test eax, eax
.text:004D84A6 jl short loc_4D84D0
.text:004D84A8 mov edi, offset aRegardsYouIndi ; "regards you indifferently"
.text:004D84AD or ecx, 0FFFFFFFFh
.text:004D84B0 xor eax, eax
.text:004D84B2 lea esi, [esp+428h+var_300]
.text:004D84B9 repne scasb
.text:004D84BB not ecx
.text:004D84BD sub edi, ecx
.text:004D84BF mov [esp+428h+var_418], esi
.text:004D84C3 mov esi, edi
.text:004D84C5 mov edi, [esp+428h+var_418]
.text:004D84C9 mov eax, ecx
.text:004D84CB jmp loc_4D856E
.text:004D84D0 ; ---------------------------------------------------------------------------
.text:004D84D0
.text:004D84D0 loc_4D84D0: ; CODE XREF: sub_4D8340+166j
.text:004D84D0 cmp eax, -750
.text:004D84D5 jge short loc_4D84FC
.text:004D84D7 mov edi, offset aScowlsAtYouRea ; "scowls at you, ready to attack"
.text:004D84DC or ecx, 0FFFFFFFFh
.text:004D84DF xor eax, eax
.text:004D84E1 lea esi, [esp+428h+var_300]
.text:004D84E8 repne scasb
.text:004D84EA not ecx
.text:004D84EC sub edi, ecx
.text:004D84EE mov [esp+428h+var_418], esi
.text:004D84F2 mov esi, edi
.text:004D84F4 mov edi, [esp+428h+var_418]
.text:004D84F8 mov eax, ecx
.text:004D84FA jmp short loc_4D856E
.text:004D84FC ; ---------------------------------------------------------------------------
.text:004D84FC
.text:004D84FC loc_4D84FC: ; CODE XREF: sub_4D8340+195j
.text:004D84FC cmp eax, -500
.text:004D8501 jge short loc_4D8528
.text:004D8503 mov edi, offset aGlaresAtYouThr ; "glares at you threateningly"
.text:004D8508 or ecx, 0FFFFFFFFh
.text:004D850B xor eax, eax
.text:004D850D lea esi, [esp+428h+var_300]
.text:004D8514 repne scasb
.text:004D8516 not ecx
.text:004D8518 sub edi, ecx
.text:004D851A mov [esp+428h+var_418], esi
.text:004D851E mov esi, edi
.text:004D8520 mov edi, [esp+428h+var_418]
.text:004D8524 mov eax, ecx
.text:004D8526 jmp short loc_4D856E
.text:004D8528 ; ---------------------------------------------------------------------------
.text:004D8528
.text:004D8528 loc_4D8528: ; CODE XREF: sub_4D8340+1C1j
.text:004D8528 cmp eax, -100
.text:004D852B lea esi, [esp+428h+var_300]
.text:004D8532 jge short loc_4D8552
.text:004D8534 mov edi, offset aGlowersAtYouDu ; "glowers at you dubiously"
.text:004D8539 or ecx, 0FFFFFFFFh
.text:004D853C xor eax, eax
.text:004D853E mov [esp+428h+var_418], esi
.text:004D8542 repne scasb
.text:004D8544 not ecx
.text:004D8546 sub edi, ecx
.text:004D8548 mov esi, edi
.text:004D854A mov edi, [esp+428h+var_418]
.text:004D854E mov eax, ecx
.text:004D8550 jmp short loc_4D856E
.text:004D8552 ; ---------------------------------------------------------------------------
.text:004D8552
.text:004D8552 loc_4D8552: ; CODE XREF: sub_4D8340+1F2j
.text:004D8552 mov edi, offset aLooksYourWayAp ; "looks your way apprehensively"
.text:004D8557 or ecx, 0FFFFFFFFh
.text:004D855A xor eax, eax
.text:004D855C mov [esp+428h+var_418], esi
.text:004D8560 repne scasb
.text:004D8562 not ecx
.text:004D8564 sub edi, ecx
.text:004D8566 mov esi, edi
.text:004D8568 mov edi, [esp+428h+var_418]
.text:004D856C mov eax, ecx
.text:004D856E
.text:004D856E loc_4D856E: ; CODE XREF: sub_4D8340+103j
.text:004D856E ; sub_4D8340+132j ...
.text:004D856E shr ecx, 2
.text:004D8571 rep movsd
.text:004D8573 mov ecx, eax
.text:004D8575 lea eax, [edx+edx*2]
.text:004D8578 cdq
.text:004D8579 and edx, 3
.text:004D857C and ecx, 3
.text:004D857F add eax, edx
.text:004D8581 sar eax, 2
.text:004D8584 cmp eax, ebx
.text:004D8586 rep movsb
.text:004D8588 jle short loc_4D8596
.text:004D858A cmp ebp, 0FFFFFFFDh
.text:004D858D jge short loc_4D8596
.text:004D858F mov ebx, 2
.text:004D8594 jmp short loc_4D85B6
<skipping code that generates con'ing part of message>
.text:004D8706 loc_4D8706: ; CODE XREF: sub_4D8340+285j
.text:004D8706 ; sub_4D8340+293j ...
.text:004D8706 mov eax, [esp+428h+arg_4] ; jumptable 004D85D3 default case
.text:004D870D lea ecx, [esp+428h+var_400]
.text:004D8711 lea edx, [esp+428h+var_300]
.text:004D8718 push ecx
.text:004D8719 mov ecx, dword_716810
.text:004D871F inc eax
.text:004D8720 push edx
.text:004D8721 push eax
.text:004D8722 call sub_4DEA40
.text:004D8727 push eax
.text:004D8728 lea ecx, [esp+434h+var_200]
.text:004D872F push offset aSSS_1 ; "%s %s -- %s"
.text:004D8734 push ecx ; char *
.text:004D8735 call _sprintf
.text:004D873A mov ecx, dword_716810
.text:004D8740 add esp, 14h
.text:004D8743 lea edx, [esp+428h+var_200]
.text:004D874A push ebx
.text:004D874B push edx
.text:004D874C call sub_4DEBA0
.text:004D8751 pop edi
.text:004D8752 pop esi
.text:004D8753 pop ebp
.text:004D8754 mov eax, 1
.text:004D8759 pop ebx
.text:004D875A add esp, 418h
.text:004D8760 retn
.text:004D8760 sub_4D8340 endp
Here is the assembly from a Velious era (June 2001) executable:
.text:004C05FC loc_4C05FC: ; CODE XREF: sub_4C05C9+2Aj
.text:004C05FC movzx eax, byte ptr [ebx+9Ch]
.text:004C0603 sub eax, 0
.text:004C0606 jz short loc_4C0619
.text:004C0608 dec eax
.text:004C0609 jz short loc_4C0612
.text:004C060B push offset aIt ; "it"
.text:004C0610 jmp short loc_4C061E
.text:004C0612 ; ---------------------------------------------------------------------------
.text:004C0612
.text:004C0612 loc_4C0612: ; CODE XREF: sub_4C05C9+40j
.text:004C0612 push offset aShe ; "she"
.text:004C0617 jmp short loc_4C061E
.text:004C0619 ; ---------------------------------------------------------------------------
.text:004C0619
.text:004C0619 loc_4C0619: ; CODE XREF: sub_4C05C9+3Dj
.text:004C0619 push offset aHe ; "he"
.text:004C061E
.text:004C061E loc_4C061E: ; CODE XREF: sub_4C05C9+47j
.text:004C061E ; sub_4C05C9+4Ej
.text:004C061E lea eax, [ebp+var_10]
.text:004C0621 push eax ; char *
.text:004C0622 call _strcpy
.text:004C0627 cmp byte ptr [ebx+98h], 0
.text:004C062E pop ecx
.text:004C062F pop ecx
.text:004C0630 jnz short loc_4C0634
.text:004C0632 xor esi, esi
.text:004C0634
.text:004C0634 loc_4C0634: ; CODE XREF: sub_4C05C9+67j
.text:004C0634 cmp esi, 1100
.text:004C063A mov ebx, offset aRegardsYouAsAn ; "regards you as an ally"
.text:004C063F jl short loc_4C0644
.text:004C0641 push ebx
.text:004C0642 jmp short loc_4C06A8
.text:004C0644 ; ---------------------------------------------------------------------------
.text:004C0644
.text:004C0644 loc_4C0644: ; CODE XREF: sub_4C05C9+76j
.text:004C0644 cmp esi, 750
.text:004C064A jl short loc_4C0653
.text:004C064C push offset aLooksUponYouWa ; "looks upon you warmly"
.text:004C0651 jmp short loc_4C06A8
.text:004C0653 ; ---------------------------------------------------------------------------
.text:004C0653
.text:004C0653 loc_4C0653: ; CODE XREF: sub_4C05C9+81j
.text:004C0653 cmp esi, 500
.text:004C0659 jl short loc_4C0662
.text:004C065B push offset aKindlyConsider ; "kindly considers you"
.text:004C0660 jmp short loc_4C06A8
.text:004C0662 ; ---------------------------------------------------------------------------
.text:004C0662
.text:004C0662 loc_4C0662: ; CODE XREF: sub_4C05C9+90j
.text:004C0662 cmp esi, 100
.text:004C0665 jl short loc_4C066E
.text:004C0667 push offset aJudgesYouAmiab ; "judges you amiably"
.text:004C066C jmp short loc_4C06A8
.text:004C066E ; ---------------------------------------------------------------------------
.text:004C066E
.text:004C066E loc_4C066E: ; CODE XREF: sub_4C05C9+9Cj
.text:004C066E test esi, esi
.text:004C0670 jl short loc_4C0679
.text:004C0672 push offset aRegardsYouIndi ; "regards you indifferently"
.text:004C0677 jmp short loc_4C06A8
.text:004C0679 ; ---------------------------------------------------------------------------
.text:004C0679
.text:004C0679 loc_4C0679: ; CODE XREF: sub_4C05C9+A7j
.text:004C0679 cmp esi, -750
.text:004C067F jge short loc_4C0688
.text:004C0681 push offset aScowlsAtYouRea ; "scowls at you, ready to attack"
.text:004C0686 jmp short loc_4C06A8
.text:004C0688 ; ---------------------------------------------------------------------------
.text:004C0688
.text:004C0688 loc_4C0688: ; CODE XREF: sub_4C05C9+B6j
.text:004C0688 cmp esi, -500
.text:004C068E jge short loc_4C0697
.text:004C0690 push offset aGlaresAtYouThr ; "glares at you threateningly"
.text:004C0695 jmp short loc_4C06A8
.text:004C0697 ; ---------------------------------------------------------------------------
.text:004C0697
.text:004C0697 loc_4C0697: ; CODE XREF: sub_4C05C9+C5j
.text:004C0697 cmp esi, -100
.text:004C069A jge short loc_4C06A3
.text:004C069C push offset aGlowersAtYouDu ; "glowers at you dubiously"
.text:004C06A1 jmp short loc_4C06A8
.text:004C06A3 ; ---------------------------------------------------------------------------
.text:004C06A3
.text:004C06A3 loc_4C06A3: ; CODE XREF: sub_4C05C9+D1j
.text:004C06A3 push offset aLooksYourWayAp ; "looks your way apprehensively"
.text:004C06A8
.text:004C06A8 loc_4C06A8: ; CODE XREF: sub_4C05C9+79j
.text:004C06A8 ; sub_4C05C9+88j ...
.text:004C06A8 lea eax, [ebp+var_210]
.text:004C06AE push eax ; char *
.text:004C06AF call _strcpy
.text:004C06B4 cmp dword ptr [edi+18h], 4
.text:004C06B8 pop ecx
.text:004C06B9 pop ecx
.text:004C06BA jnz short loc_4C0736
.text:004C06BC push 0
.text:004C06BE push dword_6ACCB4
.text:004C06C4 push [ebp+arg_4]
.text:004C06C7 call sub_4AA11A
.text:004C06CC add esp, 0Ch
.text:004C06CF test eax, eax
.text:004C06D1 jz short loc_4C0727
.text:004C06D3 mov eax, dword_6ACCB4
.text:004C06D8 movsx eax, word ptr [eax+12Ah]
.text:004C06DF push eax
.text:004C06E0 call sub_4AA041
.text:004C06E5 mov esi, eax
.text:004C06E7 mov eax, [ebp+arg_4]
.text:004C06EA movsx eax, word ptr [eax+12Ah]
.text:004C06F1 push eax
.text:004C06F2 call sub_4AA041
.text:004C06F7 pop ecx
.text:004C06F8 cmp esi, 2
.text:004C06FB pop ecx
.text:004C06FC jz short loc_4C070D
.text:004C06FE cmp esi, 1
.text:004C0701 jz short loc_4C0708
.text:004C0703 cmp esi, 3
.text:004C0706 jnz short loc_4C0720
.text:004C0708
.text:004C0708 loc_4C0708: ; CODE XREF: sub_4C05C9+138j
.text:004C0708 cmp eax, 2
.text:004C070B jnz short loc_4C0720
.text:004C070D
.text:004C070D loc_4C070D: ; CODE XREF: sub_4C05C9+133j
.text:004C070D lea eax, [ebp+var_210]
.text:004C0713 push offset aLooksYourWayAp ; "looks your way apprehensively"
.text:004C0718 push eax ; char *
.text:004C0719 call _strcpy
.text:004C071E jmp short loc_4C0734
.text:004C0720 ; ---------------------------------------------------------------------------
.text:004C0720
.text:004C0720 loc_4C0720: ; CODE XREF: sub_4C05C9+13Dj
.text:004C0720 ; sub_4C05C9+142j
.text:004C0720 push offset aGlaresAtYouThr ; "glares at you threateningly"
.text:004C0725 jmp short loc_4C0728
.text:004C0727 ; ---------------------------------------------------------------------------
.text:004C0727
.text:004C0727 loc_4C0727: ; CODE XREF: sub_4C05C9+108j
.text:004C0727 push ebx ; char *
.text:004C0728
.text:004C0728 loc_4C0728: ; CODE XREF: sub_4C05C9+15Cj
.text:004C0728 lea eax, [ebp+var_210]
.text:004C072E push eax ; char *
.text:004C072F call _sprintf
Note: The Velious code also has a special section just after this, but before mob strength is determined, that does some special checking of the God values and forces your con to either apprehensive or threatening. I haven't spent any time trying to fiure out under what conditions these forced con's are applied though.
EQEmuUser
05-20-2015, 12:46 PM
Changing these numbers will result in huge headaches :P
Does this imply that you guys have known about this for some time, and just didn't want to put all the server operators through the trouble of breaking their faction systems?
It seems such a shame that so many servers out there attempt to replicate the original game, but are so off in this one department. The emulator (in its current state) makes the game much more grindy than it was in original.
Correct me if I'm wrong, but EQEmu doesn't actually ship with any base faction_list table, does it?
I understand that most people might be using PEQ as the base for their servers and that the faction_list table in PEQ was probably created around the wrong numbers, but couldn't the base EQEmu be made correct by moving the faction range values into a config file (or somewhere else in the database).
This way, the emulator could ship with the correct faction range values, but still allow all of the server operators to change the faction ranges without having to recompile the code. This would allow all the old server operators to run with their incorrect faction range values.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.