54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
// Package factions provides comprehensive faction management for the EQ2 server emulator.
|
|
//
|
|
// The faction system manages relationships between players, NPCs, and various game entities.
|
|
// It includes consideration levels (con), hostile/friendly relationships, and dynamic faction
|
|
// value changes based on player actions.
|
|
//
|
|
// Basic Usage:
|
|
//
|
|
// // Create a new faction
|
|
// faction := factions.New(db)
|
|
// faction.ID = 1001
|
|
// faction.Name = "Guards of Qeynos"
|
|
// faction.Type = "City"
|
|
// faction.Description = "The brave guards protecting Qeynos"
|
|
// faction.DefaultValue = 0
|
|
// faction.Save()
|
|
//
|
|
// // Load an existing faction
|
|
// loaded, _ := factions.Load(db, 1001)
|
|
// loaded.PositiveChange = 100
|
|
// loaded.Save()
|
|
//
|
|
// // Delete a faction
|
|
// loaded.Delete()
|
|
//
|
|
// Master List Management:
|
|
//
|
|
// masterList := factions.NewMasterList()
|
|
// masterList.AddFaction(faction)
|
|
//
|
|
// // Lookup by ID or name
|
|
// found := masterList.GetFaction(1001)
|
|
// byName := masterList.GetFactionByName("Guards of Qeynos")
|
|
//
|
|
// // Add relationships
|
|
// masterList.AddHostileFaction(1001, 1002) // Guards hate bandits
|
|
// masterList.AddFriendlyFaction(1001, 1003) // Guards like merchants
|
|
//
|
|
// Player Faction System:
|
|
//
|
|
// playerFaction := factions.NewPlayerFaction(masterList)
|
|
// playerFaction.IncreaseFaction(1001, 100) // Gain faction
|
|
// playerFaction.DecreaseFaction(1002, 50) // Lose faction
|
|
//
|
|
// // Check consideration level (-4 to +4)
|
|
// con := playerFaction.GetCon(1001)
|
|
// if con <= factions.AttackThreshold {
|
|
// // Player is KOS to this faction
|
|
// }
|
|
//
|
|
// The system integrates with the broader EQ2 server architecture including database
|
|
// persistence, client packet updates, quest prerequisites, and NPC behavior.
|
|
package factions
|